00001 00002 #ifndef _INSTIGATE_OPEN_SOURCE_INTERNAL_HEADER_IN_CONCEPT 00003 #error This is an internal header file used to implement Instigate Open Source.\ It should never be included directly by a program. 00004 #endif 00005 00006 #ifndef INSTIGATE_GENERIC_DEFAULT_CONSTRUCTIBLE_HPP 00007 #define INSTIGATE_GENERIC_DEFAULT_CONSTRUCTIBLE_HPP 00008 00032 // Headers from this project 00033 00034 // Headers from other projects 00035 00036 // Headers from standard libraries 00037 #include <new> 00038 00039 // Forward declaration 00040 namespace instigate { 00051 namespace default_constructible { 00052 struct tag; 00053 template <typename T> struct interface; 00054 template <typename T> struct requirements; 00055 } 00056 } 00057 00064 struct instigate::default_constructible::tag 00065 { 00066 }; 00067 00072 template<typename T> 00073 struct instigate::default_constructible::interface 00074 { 00082 static T* initialize(char* const p) 00083 { 00084 return ::new (static_cast<void*>(p)) T(); 00085 } 00086 }; 00087 00095 template<typename T> 00096 struct instigate::default_constructible::requirements 00097 { 00101 static void require_initialize(char* p) 00102 { 00103 instigate::default_constructible::interface<T>::initialize(p); 00104 } 00105 00113 requirements() 00114 { 00115 &require_initialize; 00116 } 00117 }; 00118 00119 // vim:et:tabstop=8:shiftwidth=8:cindent:fo=croq:textwidth=80: 00120 00121 #endif // INSTIGATE_GENERIC_DEFAULT_CONSTRUCTIBLE_HPP