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#pragma once
6
7namespace beast {
8namespace unit_test {
9namespace detail {
10
15template <class Container>
17{
18private:
19 using cont_type = Container;
20
22
23protected:
26 {
27 return m_cont;
28 }
29
30 cont_type const&
31 cont() const
32 {
33 return m_cont;
34 }
35
36public:
37 using value_type = typename cont_type::value_type;
38 using size_type = typename cont_type::size_type;
39 using difference_type = typename cont_type::difference_type;
40 using iterator = typename cont_type::const_iterator;
41 using const_iterator = typename cont_type::const_iterator;
42
44 bool
45 empty() const
46 {
47 return m_cont.empty();
48 }
49
52 size() const
53 {
54 return m_cont.size();
55 }
56
60 begin() const
61 {
62 return m_cont.cbegin();
63 }
64
66 cbegin() const
67 {
68 return m_cont.cbegin();
69 }
70
72 end() const
73 {
74 return m_cont.cend();
75 }
76
78 cend() const
79 {
80 return m_cont.cend();
81 }
83};
84
85} // namespace detail
86} // namespace unit_test
87} // namespace beast
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.