00001 00002 #ifndef _INSTIGATE_OPEN_SOURCE_INTERNAL_HEADER_IN_CONCEPT 00003 #error This is an internal header file used to implement Instigate Open Source.\ 00004 It should never be included directly by a program. 00005 #endif 00006 00007 #ifndef INSTIGATE_GENERIC_DEFAULT_CONSTRUCTIBLE_HPP 00008 #define INSTIGATE_GENERIC_DEFAULT_CONSTRUCTIBLE_HPP 00009 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 { 00041 namespace generic { 00053 namespace default_constructible { 00054 struct tag; 00055 template <typename T> struct interface; 00056 template <typename T> struct requirements; 00057 } 00058 } 00059 } 00060 00067 struct instigate::generic::default_constructible::tag 00068 { 00069 }; 00070 00075 template<typename T> 00076 struct instigate::generic::default_constructible::interface 00077 { 00085 static T* initialize(char* const p) 00086 { 00087 return ::new (static_cast<void*>(p)) T(); 00088 } 00089 }; 00090 00098 template<typename T> 00099 struct instigate::generic::default_constructible::requirements 00100 { 00101 private: 00106 static void require_initialize(char* p) 00107 { 00108 instigate::generic::default_constructible::interface<T> 00109 ::initialize(p); 00110 } 00111 00113 public: 00114 00122 requirements() 00123 { 00124 (void)require_initialize; 00125 } 00126 00128 private: 00130 requirements(const requirements&) throw(); 00131 00133 requirements& operator=(const requirements&) throw(); 00134 }; 00135 00136 // vim:et:tabstop=8:shiftwidth=8:cindent:fo=croq:textwidth=80: 00137 00138 #endif // INSTIGATE_GENERIC_DEFAULT_CONSTRUCTIBLE_HPP