rippled
Loading...
Searching...
No Matches
const_container.h
1//
2// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
3//
4// Distributed under the Boost Software License, Version 1.0. (See accompanying
5// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7
8#ifndef BEAST_UNIT_TEST_DETAIL_CONST_CONTAINER_HPP
9#define BEAST_UNIT_TEST_DETAIL_CONST_CONTAINER_HPP
10
11namespace beast {
12namespace unit_test {
13namespace detail {
14
19template <class Container>
21{
22private:
23 using cont_type = Container;
24
26
27protected:
30 {
31 return m_cont;
32 }
33
34 cont_type const&
35 cont() const
36 {
37 return m_cont;
38 }
39
40public:
41 using value_type = typename cont_type::value_type;
42 using size_type = typename cont_type::size_type;
43 using difference_type = typename cont_type::difference_type;
44 using iterator = typename cont_type::const_iterator;
45 using const_iterator = typename cont_type::const_iterator;
46
48 bool
49 empty() const
50 {
51 return m_cont.empty();
52 }
53
56 size() const
57 {
58 return m_cont.size();
59 }
60
64 begin() const
65 {
66 return m_cont.cbegin();
67 }
68
70 cbegin() const
71 {
72 return m_cont.cbegin();
73 }
74
76 end() const
77 {
78 return m_cont.cend();
79 }
80
82 cend() const
83 {
84 return m_cont.cend();
85 }
87};
88
89} // namespace detail
90} // namespace unit_test
91} // namespace beast
92
93#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.