distortos  v0.5.0
object-oriented C++ RTOS for microcontrollers
storageDeleter.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_INTERNAL_MEMORY_STORAGEDELETER_HPP_
13 #define INCLUDE_DISTORTOS_INTERNAL_MEMORY_STORAGEDELETER_HPP_
14 
15 namespace distortos
16 {
17 
18 namespace internal
19 {
20 
21 /*---------------------------------------------------------------------------------------------------------------------+
22 | global functions' declarations
23 +---------------------------------------------------------------------------------------------------------------------*/
24 
34 template<typename T, typename U>
35 void storageDeleter(U* const storage)
36 {
37  delete[] reinterpret_cast<T*>(storage);
38 }
39 
40 } // namespace internal
41 
42 } // namespace distortos
43 
44 #endif // INCLUDE_DISTORTOS_INTERNAL_MEMORY_STORAGEDELETER_HPP_
Top-level namespace of distortos project.
void storageDeleter(U *const storage)
Templated deleter that can be used with std::unique_ptr and dynamic storage allocated with new T[]...
Definition: storageDeleter.hpp:35