13 T * t_src =
reinterpret_cast< T *
>( src );
14 T * t_self =
new T( *t_src );
15 return reinterpret_cast< T *
>( t_self );
20 T * t_src =
reinterpret_cast< T *
>( src );
21 T * t_self =
new (place) T( *t_src );
22 return reinterpret_cast< T *
>( t_self );
27 T * t_self =
reinterpret_cast< T *
>( self );
33 T * t_self =
reinterpret_cast< T *
>( self );
39 T * t_self =
reinterpret_cast< T *
>( self );
40 T * t_src =
reinterpret_cast< T *
>( src );
46 T * t_self =
reinterpret_cast< T *
>( self );
88 template<
class Type,
class SubType >
90 _idx( Type::SubDirectoryInst.next++ )
94 template<
class Type,
class SubType >
100 template<
class Type,
class SubType >
103 return Type::SubDirectoryInst.next;
108 static void l_dynamic_deleter(
void * ptr )
110 delete reinterpret_cast< T *
>( ptr );
114 static void l_static_deleter(
void * ptr )
116 T * t =
reinterpret_cast< T *
>( ptr );
120 template<
class SubType,
size_t LocalItems,
size_t LocalStorage >
129 template<
class SubType,
size_t LocalItems,
size_t LocalStorage >
137 s.functions->destroy_inplace( s.inst );
139 s.functions->destroy_delete( s.inst );
145 s.functions->destroy_inplace( s.inst );
147 s.functions->destroy_delete( s.inst );
151 template<
class SubType,
size_t LocalItems,
size_t LocalStorage >
159 s.functions->destroy_inplace( s.inst );
161 s.functions->destroy_delete( s.inst );
163 s.functions =
nullptr;
171 s.functions->destroy_inplace( s.inst );
173 s.functions->destroy_delete( s.inst );
175 s.functions =
nullptr;
180 this->static_mem_used = 0;
183 template<
class Type,
size_t LocalItems,
size_t LocalStorage >
186 bool dir_dynamic = idx > LocalItems;
189 return &this->dir_local[ idx ];
193 size_t dyn_idx = Type::SubDirectoryInst.next - LocalItems;
194 this->dir_dynamic.resize( dyn_idx );
195 return &this->dir_dynamic[ dyn_idx ];
199 template<
class Type,
size_t LocalItems,
size_t LocalStorage >
200 template<
class SubType >
204 S * s = this->getS(
id.idx() );
210 void * ptr = mem_local.data() + this->static_mem_used;
211 size_t space = LocalStorage - this->static_mem_used;
212 void * aligned = std::align(
alignof( SubType ),
sizeof( SubType ), ptr, space );
217 this->static_mem_used = LocalStorage - space;
218 s->inst =
reinterpret_cast< void *
>(
new ( aligned ) SubType );
224 s->inst =
reinterpret_cast< void *
>(
new SubType );
231 return *
reinterpret_cast< SubType *
>( s->inst );
234 template<
class Type,
size_t LocalItems,
size_t LocalStorage >
238 S * s = this->getS( idx );
246 void * ptr = mem_local.data() + this->static_mem_used;
247 size_t space = LocalStorage - this->static_mem_used;
248 void * aligned = std::align( s_src.functions->alignof_v, s_src.functions->sizeof_v, ptr, space );
253 this->static_mem_used = LocalStorage - space;
254 s->inst = s_src.functions->copy_inplace( aligned, s_src.inst );
255 s->functions = s_src.functions;
260 s->inst = s_src.functions->copy_new( s_src.inst );
261 s->functions = s_src.functions;
267 s_src.functions->assign_copy( s->inst, s_src.inst );
275 s->functions->assign_default( s->inst );
280 template<
class Type,
size_t LocalItems,
size_t LocalStorage >
285 for( S
const & s : src.dir_local )
288 this->copy( idx, s );
292 for( S
const & s : src.dir_dynamic )
295 this->copy( idx, s );
300 template<
class Type,
size_t LocalItems,
size_t LocalStorage >
305 for( S
const & s : src.dir_local )
308 this->assign_copy( idx, s );
312 for( S
const & s : src.dir_dynamic )
315 this->assign_copy( idx, s );