00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _INSTIGATE_OPEN_SOURCE_INTERNAL_HEADER_IN_CONCEPT
00024 #error This is an internal header file used to implement Instigate Open Source.\
00025 It should never be included directly by a program.
00026 #endif
00027
00028 #ifndef INSTIGATE_GENERIC_DEFAULT_CONSTRUCTIBLE_HPP
00029 #define INSTIGATE_GENERIC_DEFAULT_CONSTRUCTIBLE_HPP
00030
00039
00040
00041
00042
00043
00044 #include <new>
00045
00046
00047 namespace instigate {
00058 namespace default_constructible {
00059 struct tag;
00060 template <typename T> struct interface;
00061 template <typename T> struct requirements;
00062 }
00063 }
00064
00071 struct instigate::default_constructible::tag
00072 {
00073 };
00074
00079 template<typename T>
00080 struct instigate::default_constructible::interface
00081 {
00089 static T* initialize(char* const p)
00090 {
00091 return ::new (static_cast<void*>(p)) T();
00092 }
00093 };
00094
00102 template<typename T>
00103 struct instigate::default_constructible::requirements
00104 {
00105
00106 private:
00107 void check_default_constructible()
00108 {
00109 T t;
00110 (void)t;
00111 }
00115 static void require_initialize(char* p)
00116 {
00117 instigate::default_constructible::interface<T>::initialize(p);
00118 }
00119
00127 public:
00128 requirements()
00129 {
00130 (void)&requirements<T>::require_initialize;
00131 }
00132
00133
00135
00137
00138
00139
00140 };
00141
00142
00143
00144 #endif // INSTIGATE_GENERIC_DEFAULT_CONSTRUCTIBLE_HPP