16#ifndef dealii_smartpointer_h
17#define dealii_smartpointer_h
66template <
typename T,
typename P =
void>
145 operator T *()
const;
202 const std::string
id;
215template <
typename T,
typename P>
218 , id(typeid(P).name())
219 , pointed_to_object_is_alive(false)
224template <
typename T,
typename P>
227 , id(typeid(P).name())
228 , pointed_to_object_is_alive(false)
236template <
typename T,
typename P>
240 , pointed_to_object_is_alive(false)
248template <
typename T,
typename P>
253 , pointed_to_object_is_alive(false)
261template <
typename T,
typename P>
265 , pointed_to_object_is_alive(false)
273template <
typename T,
typename P>
276 if (pointed_to_object_is_alive && t !=
nullptr)
277 t->unsubscribe(&pointed_to_object_is_alive,
id);
282template <
typename T,
typename P>
286 if (pointed_to_object_is_alive && t !=
nullptr)
288 t->unsubscribe(&pointed_to_object_is_alive,
id);
297template <
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);
316template <
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);
337template <
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);
357template <
typename T,
typename P>
365template <
typename T,
typename P>
369 Assert(pointed_to_object_is_alive,
370 ExcMessage(
"The object pointed to is not valid anymore."));
376template <
typename T,
typename P>
380 Assert(pointed_to_object_is_alive,
381 ExcMessage(
"The object pointed to is not valid anymore."));
387template <
typename T,
typename P>
403template <
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);
418template <
typename T,
typename P>
441template <
typename T,
typename P,
class Q>
457template <
typename T,
typename P>
473template <
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
#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)