16 #ifndef dealii_smartpointer_h
17 #define dealii_smartpointer_h
66 template <
typename T,
typename P =
void>
145 operator T *()
const;
202 const std::string
id;
215 template <
typename T,
typename P>
218 , id(typeid(P).name())
219 , pointed_to_object_is_alive(false)
224 template <
typename T,
typename P>
227 , id(typeid(P).name())
228 , pointed_to_object_is_alive(false)
236 template <
typename T,
typename P>
240 , pointed_to_object_is_alive(false)
248 template <
typename T,
typename P>
253 , pointed_to_object_is_alive(false)
261 template <
typename T,
typename P>
265 , pointed_to_object_is_alive(false)
273 template <
typename T,
typename P>
276 if (pointed_to_object_is_alive && t !=
nullptr)
277 t->unsubscribe(&pointed_to_object_is_alive,
id);
282 template <
typename T,
typename P>
286 if (pointed_to_object_is_alive && t !=
nullptr)
288 t->unsubscribe(&pointed_to_object_is_alive,
id);
297 template <
typename T,
typename P>
306 if (pointed_to_object_is_alive && t !=
nullptr)
307 t->unsubscribe(&pointed_to_object_is_alive,
id);
310 tt->subscribe(&pointed_to_object_is_alive,
id);
316 template <
typename T,
typename P>
327 if (pointed_to_object_is_alive && t !=
nullptr)
328 t->unsubscribe(&pointed_to_object_is_alive,
id);
329 t =
static_cast<T *
>(tt);
331 tt->subscribe(&pointed_to_object_is_alive,
id);
337 template <
typename T,
typename P>
347 if (pointed_to_object_is_alive && t !=
nullptr)
348 t->unsubscribe(&pointed_to_object_is_alive,
id);
349 t =
static_cast<T *
>(tt);
351 tt->subscribe(&pointed_to_object_is_alive,
id);
357 template <
typename T,
typename P>
365 template <
typename T,
typename P>
369 Assert(pointed_to_object_is_alive,
370 ExcMessage(
"The object pointed to is not valid anymore."));
376 template <
typename T,
typename P>
380 Assert(pointed_to_object_is_alive,
381 ExcMessage(
"The object pointed to is not valid anymore."));
387 template <
typename T,
typename P>
403 template <
typename T,
typename P>
407 if (pointed_to_object_is_alive && t !=
nullptr)
408 t->unsubscribe(pointed_to_object_is_alive,
id);
413 t->subscribe(pointed_to_object_is_alive,
id);
418 template <
typename T,
typename P>
441 template <
typename T,
typename P,
class Q>
457 template <
typename T,
typename P>
473 template <
typename T,
typename P>
void swap(BlockIndices &u, BlockIndices &v)
void swap(SmartPointer< T, Q > &tt)
SmartPointer(const SmartPointer< T, P > &tt)
SmartPointer< T, P > & operator=(const SmartPointer< T, P > &tt)
std::atomic< bool > pointed_to_object_is_alive
SmartPointer(const SmartPointer< T, Q > &tt)
std::size_t memory_consumption() const
SmartPointer< T, P > & operator=(const SmartPointer< T, Q > &tt)
SmartPointer(T *t, const std::string &id)
SmartPointer< T, P > & operator=(T *tt)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcNotInitialized()
#define Assert(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)
void swap(SmartPointer< T, P > &t1, SmartPointer< T, Q > &t2)