16 #ifndef dealii_smartpointer_h
17 #define dealii_smartpointer_h
66 template <
typename T,
typename P =
void>
145 operator T *()
const;
211 const std::string
id;
224 template <
typename T,
typename P>
227 , id(typeid(P).name())
228 , pointed_to_object_is_alive(false)
233 template <
typename T,
typename P>
236 , id(typeid(P).name())
237 , pointed_to_object_is_alive(false)
245 template <
typename T,
typename P>
249 , pointed_to_object_is_alive(false)
257 template <
typename T,
typename P>
262 , pointed_to_object_is_alive(false)
270 template <
typename T,
typename P>
274 , pointed_to_object_is_alive(false)
282 template <
typename T,
typename P>
285 if (pointed_to_object_is_alive && t !=
nullptr)
286 t->unsubscribe(&pointed_to_object_is_alive,
id);
291 template <
typename T,
typename P>
295 if (pointed_to_object_is_alive && t !=
nullptr)
297 t->unsubscribe(&pointed_to_object_is_alive,
id);
306 template <
typename T,
typename P>
315 if (pointed_to_object_is_alive && t !=
nullptr)
316 t->unsubscribe(&pointed_to_object_is_alive,
id);
319 tt->subscribe(&pointed_to_object_is_alive,
id);
325 template <
typename T,
typename P>
336 if (pointed_to_object_is_alive && t !=
nullptr)
337 t->unsubscribe(&pointed_to_object_is_alive,
id);
338 t =
static_cast<T *
>(tt);
340 tt->subscribe(&pointed_to_object_is_alive,
id);
346 template <
typename T,
typename P>
356 if (pointed_to_object_is_alive && t !=
nullptr)
357 t->unsubscribe(&pointed_to_object_is_alive,
id);
358 t =
static_cast<T *
>(tt);
360 tt->subscribe(&pointed_to_object_is_alive,
id);
366 template <
typename T,
typename P>
374 template <
typename T,
typename P>
379 Assert(pointed_to_object_is_alive,
380 ExcMessage(
"The object pointed to is not valid anymore."));
386 template <
typename T,
typename P>
391 Assert(pointed_to_object_is_alive,
392 ExcMessage(
"The object pointed to is not valid anymore."));
398 template <
typename T,
typename P>
407 template <
typename T,
typename P>
423 template <
typename T,
typename P>
427 if (pointed_to_object_is_alive && t !=
nullptr)
428 t->unsubscribe(pointed_to_object_is_alive,
id);
433 t->subscribe(pointed_to_object_is_alive,
id);
438 template <
typename T,
typename P>
461 template <
typename T,
typename P,
class Q>
477 template <
typename T,
typename P>
493 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)