16 #ifndef dealii_smartpointer_h
17 #define dealii_smartpointer_h
66 template <
typename T,
typename P =
void>
145 operator T *()
const;
204 const std::string
id;
217 template <
typename T,
typename P>
220 , id(typeid(P).name())
221 , pointed_to_object_is_alive(false)
226 template <
typename T,
typename P>
229 , id(typeid(P).name())
230 , pointed_to_object_is_alive(false)
238 template <
typename T,
typename P>
242 , pointed_to_object_is_alive(false)
250 template <
typename T,
typename P>
255 , pointed_to_object_is_alive(false)
263 template <
typename T,
typename P>
267 , pointed_to_object_is_alive(false)
275 template <
typename T,
typename P>
278 if (pointed_to_object_is_alive && t !=
nullptr)
279 t->unsubscribe(&pointed_to_object_is_alive,
id);
284 template <
typename T,
typename P>
288 if (pointed_to_object_is_alive && t !=
nullptr)
290 t->unsubscribe(&pointed_to_object_is_alive,
id);
299 template <
typename T,
typename P>
308 if (pointed_to_object_is_alive && t !=
nullptr)
309 t->unsubscribe(&pointed_to_object_is_alive,
id);
312 tt->subscribe(&pointed_to_object_is_alive,
id);
318 template <
typename T,
typename P>
329 if (pointed_to_object_is_alive && t !=
nullptr)
330 t->unsubscribe(&pointed_to_object_is_alive,
id);
331 t =
static_cast<T *
>(tt);
333 tt->subscribe(&pointed_to_object_is_alive,
id);
339 template <
typename T,
typename P>
349 if (pointed_to_object_is_alive && t !=
nullptr)
350 t->unsubscribe(&pointed_to_object_is_alive,
id);
351 t =
static_cast<T *
>(tt);
353 tt->subscribe(&pointed_to_object_is_alive,
id);
359 template <
typename T,
typename P>
367 template <
typename T,
typename P>
372 Assert(pointed_to_object_is_alive,
373 ExcMessage(
"The object pointed to is not valid anymore."));
379 template <
typename T,
typename P>
384 Assert(pointed_to_object_is_alive,
385 ExcMessage(
"The object pointed to is not valid anymore."));
391 template <
typename T,
typename P>
407 template <
typename T,
typename P>
411 if (pointed_to_object_is_alive && t !=
nullptr)
412 t->unsubscribe(pointed_to_object_is_alive,
id);
417 t->subscribe(pointed_to_object_is_alive,
id);
422 template <
typename T,
typename P>
445 template <
typename T,
typename P,
class Q>
461 template <
typename T,
typename P>
477 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)