15#ifndef dealii_smartpointer_h
16#define dealii_smartpointer_h
91template <
typename T,
typename P =
void>
170 operator T *()
const;
236 const std::string
id;
249template <
typename T,
typename P>
252 , id(typeid(P).name())
253 , pointed_to_object_is_alive(false)
258template <
typename T,
typename P>
261 , id(typeid(P).name())
262 , pointed_to_object_is_alive(false)
270template <
typename T,
typename P>
274 , pointed_to_object_is_alive(false)
282template <
typename T,
typename P>
287 , pointed_to_object_is_alive(false)
295template <
typename T,
typename P>
299 , pointed_to_object_is_alive(false)
307template <
typename T,
typename P>
310 if (pointed_to_object_is_alive && t !=
nullptr)
311 t->unsubscribe(&pointed_to_object_is_alive,
id);
316template <
typename T,
typename P>
320 if (pointed_to_object_is_alive && t !=
nullptr)
322 t->unsubscribe(&pointed_to_object_is_alive,
id);
331template <
typename T,
typename P>
340 if (pointed_to_object_is_alive && t !=
nullptr)
341 t->unsubscribe(&pointed_to_object_is_alive,
id);
344 tt->subscribe(&pointed_to_object_is_alive,
id);
350template <
typename T,
typename P>
361 if (pointed_to_object_is_alive && t !=
nullptr)
362 t->unsubscribe(&pointed_to_object_is_alive,
id);
363 t =
static_cast<T *
>(tt);
365 tt->subscribe(&pointed_to_object_is_alive,
id);
371template <
typename T,
typename P>
381 if (pointed_to_object_is_alive && t !=
nullptr)
382 t->unsubscribe(&pointed_to_object_is_alive,
id);
383 t =
static_cast<T *
>(tt);
385 tt->subscribe(&pointed_to_object_is_alive,
id);
391template <
typename T,
typename P>
399template <
typename T,
typename P>
404 Assert(pointed_to_object_is_alive,
405 ExcMessage(
"The object pointed to is not valid anymore."));
411template <
typename T,
typename P>
416 Assert(pointed_to_object_is_alive,
417 ExcMessage(
"The object pointed to is not valid anymore."));
423template <
typename T,
typename P>
432template <
typename T,
typename P>
448template <
typename T,
typename P>
452 if (pointed_to_object_is_alive && t !=
nullptr)
453 t->unsubscribe(pointed_to_object_is_alive,
id);
458 t->subscribe(pointed_to_object_is_alive,
id);
463template <
typename T,
typename P>
486template <
typename T,
typename P,
class Q>
502template <
typename T,
typename P>
518template <
typename T,
typename P>
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
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcNotInitialized()
static ::ExceptionBase & ExcMessage(std::string arg1)
void swap(SmartPointer< T, P > &t1, SmartPointer< T, Q > &t2)