Loading...
Searching...
No Matches
SymEngine::EnableRCPFromThis< T > Class Template Reference
+ Collaboration diagram for SymEngine::EnableRCPFromThis< T >:

Public Member Functions

RCP< T > rcp_from_this ()
 Get RCP<T> pointer to self (it will cast the pointer to T)
 
RCP< const T > rcp_from_this () const
 Get RCP<const T> pointer to self (it will cast the pointer to const T)
 
template<class T2 >
RCP< const T2rcp_from_this_cast () const
 Get RCP<T2> pointer to self (it will cast the pointer to T2)
 
unsigned int use_count () const
 

Private Member Functions

void set_weak_self_ptr (const RCP< T > &w)
 
void set_weak_self_ptr (const RCP< const T > &w) const
 

Private Attributes

RCP< T > weak_self_ptr_
 

Friends

template<typename T_ , typename... Args>
RCP< T_make_rcp (Args &&...args)
 

Detailed Description

template<class T>
class SymEngine::EnableRCPFromThis< T >

Definition at line 277 of file symengine_rcp.h.

Member Function Documentation

◆ rcp_from_this() [1/2]

template<class T >
RCP< T > SymEngine::EnableRCPFromThis< T >::rcp_from_this ( )
inline

Get RCP<T> pointer to self (it will cast the pointer to T)

Definition at line 282 of file symengine_rcp.h.

283 {
284#if defined(WITH_SYMENGINE_RCP)
285 return rcp(static_cast<T *>(this));
286#else
287 return rcp_static_cast<T>(weak_self_ptr_.create_strong());
288#endif
289 }
void hash_combine(hash_t &seed, const T &v)
Definition basic-inl.h:95

◆ rcp_from_this() [2/2]

template<class T >
RCP< const T > SymEngine::EnableRCPFromThis< T >::rcp_from_this ( ) const
inline

Get RCP<const T> pointer to self (it will cast the pointer to const T)

Definition at line 292 of file symengine_rcp.h.

293 {
294#if defined(WITH_SYMENGINE_RCP)
295 return rcp(static_cast<const T *>(this));
296#else
297 return rcp_static_cast<const T>(weak_self_ptr_.create_strong());
298#endif
299 }

◆ rcp_from_this_cast()

template<class T >
template<class T2 >
RCP< const T2 > SymEngine::EnableRCPFromThis< T >::rcp_from_this_cast ( ) const
inline

Get RCP<T2> pointer to self (it will cast the pointer to T2)

Definition at line 303 of file symengine_rcp.h.

304 {
305#if defined(WITH_SYMENGINE_RCP)
306 return rcp(static_cast<const T2 *>(this));
307#else
308 return rcp_static_cast<const T2>(weak_self_ptr_.create_strong());
309#endif
310 }

◆ set_weak_self_ptr() [1/2]

template<class T >
void SymEngine::EnableRCPFromThis< T >::set_weak_self_ptr ( const RCP< const T > &  w) const
inlineprivate

Definition at line 351 of file symengine_rcp.h.

352 {
353 weak_self_ptr_ = rcp_const_cast<T>(w);
354 }

◆ set_weak_self_ptr() [2/2]

template<class T >
void SymEngine::EnableRCPFromThis< T >::set_weak_self_ptr ( const RCP< T > &  w)
inlineprivate

Definition at line 346 of file symengine_rcp.h.

347 {
348 weak_self_ptr_ = w;
349 }

◆ use_count()

template<class T >
unsigned int SymEngine::EnableRCPFromThis< T >::use_count ( ) const
inline

Definition at line 312 of file symengine_rcp.h.

313 {
314#if defined(WITH_SYMENGINE_RCP)
315 return refcount_;
316#else
317 return weak_self_ptr_.strong_count();
318#endif
319 }

Friends And Related Symbol Documentation

◆ make_rcp

template<class T >
template<typename T_ , typename... Args>
RCP< T_ > make_rcp ( Args &&...  args)
friend

Definition at line 367 of file symengine_rcp.h.

368{
369#if defined(WITH_SYMENGINE_RCP)
370 return rcp(new T(std::forward<Args>(args)...));
371#else
372 RCP<T> p = rcp(new T(std::forward<Args>(args)...));
373 p->set_weak_self_ptr(p.create_weak());
374 return p;
375#endif
376}

Field Documentation

◆ weak_self_ptr_

template<class T >
RCP<T> SymEngine::EnableRCPFromThis< T >::weak_self_ptr_
mutableprivate

Definition at line 344 of file symengine_rcp.h.


The documentation for this class was generated from the following file: