distortos  v0.5.0
object-oriented C++ RTOS for microcontrollers
ReferenceHolder.hpp
Go to the documentation of this file.
1 
12 #ifndef ESTD_REFERENCEHOLDER_HPP_
13 #define ESTD_REFERENCEHOLDER_HPP_
14 
15 namespace estd
16 {
17 
24 template<typename T>
26 {
27 public:
28 
35  constexpr explicit ReferenceHolder(T& reference) noexcept :
36  reference_{reference}
37  {
38 
39  }
40 
42  constexpr operator T&() const noexcept
43  {
44  return reference_;
45  }
46 
48  constexpr T& get() const noexcept
49  {
50  return reference_;
51  }
52 
53 private:
54 
57 };
58 
59 } // namespace estd
60 
61 #endif // ESTD_REFERENCEHOLDER_HPP_
Collection of useful templates.
ReferenceHolder template class is a ROMable holder of a reference.
Definition: ReferenceHolder.hpp:25
constexpr ReferenceHolder(T &reference) noexcept
ReferenceHolder constructor.
Definition: ReferenceHolder.hpp:35
T & reference_
reference held by the object
Definition: ReferenceHolder.hpp:56