15#ifndef dealii_smartpointer_h
16#define dealii_smartpointer_h
91template <
typename T,
typename P =
void>
178 operator T *()
const;
244 const std::string
id;
257template <
typename T,
typename P>
260 , id(typeid(P).name())
261 , pointed_to_object_is_alive(false)
266template <
typename T,
typename P>
269 , id(typeid(P).name())
270 , pointed_to_object_is_alive(false)
278template <
typename T,
typename P>
282 , pointed_to_object_is_alive(false)
290template <
typename T,
typename P>
295 , pointed_to_object_is_alive(false)
303template <
typename T,
typename P>
307 , pointed_to_object_is_alive(false)
315template <
typename T,
typename P>
318 if (pointed_to_object_is_alive && t !=
nullptr)
319 t->unsubscribe(&pointed_to_object_is_alive,
id);
324template <
typename T,
typename P>
328 if (pointed_to_object_is_alive && t !=
nullptr)
330 t->unsubscribe(&pointed_to_object_is_alive,
id);
339template <
typename T,
typename P>
348 if (pointed_to_object_is_alive && t !=
nullptr)
349 t->unsubscribe(&pointed_to_object_is_alive,
id);
352 tt->subscribe(&pointed_to_object_is_alive,
id);
358template <
typename T,
typename P>
369 if (pointed_to_object_is_alive && t !=
nullptr)
370 t->unsubscribe(&pointed_to_object_is_alive,
id);
371 t =
static_cast<T *
>(tt);
373 tt->subscribe(&pointed_to_object_is_alive,
id);
379template <
typename T,
typename P>
389 if (pointed_to_object_is_alive && t !=
nullptr)
390 t->unsubscribe(&pointed_to_object_is_alive,
id);
391 t =
static_cast<T *
>(tt);
393 tt->subscribe(&pointed_to_object_is_alive,
id);
399template <
typename T,
typename P>
407template <
typename T,
typename P>
412 Assert(pointed_to_object_is_alive,
413 ExcMessage(
"The object pointed to is not valid anymore."));
419template <
typename T,
typename P>
424 Assert(pointed_to_object_is_alive,
425 ExcMessage(
"The object pointed to is not valid anymore."));
431template <
typename T,
typename P>
440template <
typename T,
typename P>
456template <
typename T,
typename P>
460 if (pointed_to_object_is_alive && t !=
nullptr)
461 t->unsubscribe(pointed_to_object_is_alive,
id);
466 t->subscribe(pointed_to_object_is_alive,
id);
471template <
typename T,
typename P>
494template <
typename T,
typename P,
class Q>
510template <
typename T,
typename P>
526template <
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_DEPRECATED
#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)