xrpld
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
8
14template <class Container>
16{
17private:
18 using cont_type = Container;
19
21
22protected:
25 {
26 return cont_;
27 }
28
29 [[nodiscard]] cont_type const&
30 cont() const
31 {
32 return cont_;
33 }
34
35public:
36 using value_type = cont_type::value_type;
37 using size_type = cont_type::size_type;
38 using difference_type = cont_type::difference_type;
39 using iterator = cont_type::const_iterator;
40 using const_iterator = cont_type::const_iterator;
41
45 [[nodiscard]] bool
46 empty() const
47 {
48 return cont_.empty();
49 }
50
54 [[nodiscard]] size_type
55 size() const
56 {
57 return cont_.size();
58 }
59
64 [[nodiscard]] const_iterator
65 begin() const
66 {
67 return cont_.cbegin();
68 }
69
70 [[nodiscard]] const_iterator
71 cbegin() const
72 {
73 return cont_.cbegin();
74 }
75
76 [[nodiscard]] const_iterator
77 end() const
78 {
79 return cont_.cend();
80 }
81
82 [[nodiscard]] const_iterator
83 cend() const
84 {
85 return cont_.cend();
86 }
87
88};
89
90} // namespace beast::unit_test::detail
Adapter to constrain a container interface.
size_type size() const
Returns the number of items in the container.
cont_type::difference_type difference_type
cont_type::const_iterator const_iterator
bool empty() const
Returns true if the container is empty.
const_iterator begin() const
Returns forward iterators for traversal.