rippled
Loading...
Searching...
No Matches
const_container.h
1// Distributed under the Boost Software License, Version 1.0. (See accompanying
2// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
3//
4
5#ifndef BEAST_UNIT_TEST_DETAIL_CONST_CONTAINER_HPP
6#define BEAST_UNIT_TEST_DETAIL_CONST_CONTAINER_HPP
7
8namespace beast {
9namespace unit_test {
10namespace detail {
11
16template <class Container>
18{
19private:
20 using cont_type = Container;
21
23
24protected:
27 {
28 return m_cont;
29 }
30
31 cont_type const&
32 cont() const
33 {
34 return m_cont;
35 }
36
37public:
38 using value_type = typename cont_type::value_type;
39 using size_type = typename cont_type::size_type;
40 using difference_type = typename cont_type::difference_type;
41 using iterator = typename cont_type::const_iterator;
42 using const_iterator = typename cont_type::const_iterator;
43
45 bool
46 empty() const
47 {
48 return m_cont.empty();
49 }
50
53 size() const
54 {
55 return m_cont.size();
56 }
57
61 begin() const
62 {
63 return m_cont.cbegin();
64 }
65
67 cbegin() const
68 {
69 return m_cont.cbegin();
70 }
71
73 end() const
74 {
75 return m_cont.cend();
76 }
77
79 cend() const
80 {
81 return m_cont.cend();
82 }
84};
85
86} // namespace detail
87} // namespace unit_test
88} // namespace beast
89
90#endif
Adapter to constrain a container interface.
bool empty() const
Returns true if the container is empty.
typename cont_type::const_iterator iterator
typename cont_type::difference_type difference_type
const_iterator begin() const
Returns forward iterators for traversal.
typename cont_type::value_type value_type
typename cont_type::const_iterator const_iterator
typename cont_type::size_type size_type
size_type size() const
Returns the number of items in the container.