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
13template <class Container>
15{
16private:
17 using cont_type = Container;
18
20
21protected:
24 {
25 return cont_;
26 }
27
28 [[nodiscard]] cont_type const&
29 cont() const
30 {
31 return cont_;
32 }
33
34public:
35 using value_type = cont_type::value_type;
36 using size_type = cont_type::size_type;
37 using difference_type = cont_type::difference_type;
38 using iterator = cont_type::const_iterator;
39 using const_iterator = cont_type::const_iterator;
40
42 [[nodiscard]] bool
43 empty() const
44 {
45 return cont_.empty();
46 }
47
49 [[nodiscard]] size_type
50 size() const
51 {
52 return cont_.size();
53 }
54
57 [[nodiscard]] const_iterator
58 begin() const
59 {
60 return cont_.cbegin();
61 }
62
63 [[nodiscard]] const_iterator
64 cbegin() const
65 {
66 return cont_.cbegin();
67 }
68
69 [[nodiscard]] const_iterator
70 end() const
71 {
72 return cont_.cend();
73 }
74
75 [[nodiscard]] const_iterator
76 cend() const
77 {
78 return cont_.cend();
79 }
80
81};
82
83} // 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.