distortos  v0.5.0
object-oriented C++ RTOS for microcontrollers
ReverseAdaptor.hpp
Go to the documentation of this file.
1 
12 #ifndef ESTD_REVERSEADAPTOR_HPP_
13 #define ESTD_REVERSEADAPTOR_HPP_
14 
15 namespace estd
16 {
17 
24 template<typename T>
26 {
27 public:
28 
35  constexpr explicit ReverseAdaptor(T& container) noexcept :
36  container_{container}
37  {
38 
39  }
40 
45  typename T::reverse_iterator begin() const noexcept
46  {
47  return container_.rbegin();
48  }
49 
54  typename T::reverse_iterator end() const noexcept
55  {
56  return container_.rend();
57  }
58 
59 private:
60 
63 };
64 
75 template<typename T>
77 {
78  return ReverseAdaptor<T>{container};
79 }
80 
81 } // namespace estd
82 
83 #endif // ESTD_REVERSEADAPTOR_HPP_
Collection of useful templates.
T & container_
reference to container
Definition: ReverseAdaptor.hpp:62
constexpr ReverseAdaptor(T &container) noexcept
ReverseAdaptor&#39;s constructor.
Definition: ReverseAdaptor.hpp:35
T::reverse_iterator begin() const noexcept
Definition: ReverseAdaptor.hpp:45
ReverseAdaptor template class is an adaptor that "reverses" access to the container.
Definition: ReverseAdaptor.hpp:25
T::reverse_iterator end() const noexcept
Definition: ReverseAdaptor.hpp:54
ReverseAdaptor< T > makeReverseAdaptor(T &container)
Helper factory function to make ReverseAdaptor object with deduced template arguments.
Definition: ReverseAdaptor.hpp:76