distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
MoveConstructQueueFunctor.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_MOVECONSTRUCTQUEUEFUNCTOR_HPP_
13 #define INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_MOVECONSTRUCTQUEUEFUNCTOR_HPP_
14 
16 
17 #include <utility>
18 
19 namespace distortos
20 {
21 
22 namespace internal
23 {
24 
31 template<typename T>
33 {
34 public:
35 
42  constexpr explicit MoveConstructQueueFunctor(T&& value) :
43  value_{std::move(value)}
44  {
45 
46  }
47 
54  void operator()(void* const storage) const override
55  {
56  new (storage) T{std::move(value_)};
57  }
58 
59 private:
60 
62  T&& value_;
63 };
64 
65 } // namespace internal
66 
67 } // namespace distortos
68 
69 #endif // INCLUDE_DISTORTOS_INTERNAL_SYNCHRONIZATION_MOVECONSTRUCTQUEUEFUNCTOR_HPP_
T && value_
rvalue reference to object that will be used as argument of move constructor
Definition: MoveConstructQueueFunctor.hpp:62
Top-level namespace of distortos project.
Definition: buttons.hpp:33
QueueFunctor class header.
void operator()(void *const storage) const override
Move-constructs the element in the queue's storage.
Definition: MoveConstructQueueFunctor.hpp:54
constexpr MoveConstructQueueFunctor(T &&value)
MoveConstructQueueFunctor's constructor.
Definition: MoveConstructQueueFunctor.hpp:42
QueueFunctor is a type-erased interface for functors which execute some action on queue's storage (li...
Definition: QueueFunctor.hpp:31
Definition: MoveConstructQueueFunctor.hpp:32