libcopp 2.3.1
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Data Structures | Namespaces | Macros | Functions
intrusive_ptr.h File Reference
#include <libcopp/utils/config/stl_include_prefix.h>
#include <assert.h>
#include <cstddef>
#include <memory>
#include <ostream>
#include <libcopp/utils/config/stl_include_suffix.h>
#include <libcopp/utils/config/compile_optimize.h>
#include <libcopp/utils/config/libcopp_build_features.h>
Include dependency graph for intrusive_ptr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  memory::intrusive_ptr< T >
 

Namespaces

namespace  memory
 

Macros

#define LIBCOPP_UTIL_INTRUSIVE_PTR_ATOMIC_TYPE
 
#define LIBCOPP_UTIL_INTRUSIVE_PTR_REF_MEMBER_DECL(T)
 
#define LIBCOPP_UTIL_INTRUSIVE_PTR_REF_FN_DECL(T)
 
#define LIBCOPP_UTIL_INTRUSIVE_PTR_REF_MEMBER_INIT()   this->intrusive_ref_counter_.store(0)
 
#define LIBCOPP_UTIL_INTRUSIVE_PTR_REF_FN_DEFI(T)
 

Functions

template<typename T , typename U >
bool memory::operator== (intrusive_ptr< T > const &a, intrusive_ptr< U > const &b) noexcept
 
template<typename T , typename U >
bool memory::operator== (intrusive_ptr< T > const &a, U *b) noexcept
 
template<typename T , typename U >
bool memory::operator== (T *a, intrusive_ptr< U > const &b) noexcept
 
template<typename T , typename U >
bool memory::operator!= (intrusive_ptr< T > const &a, intrusive_ptr< U > const &b) noexcept
 
template<typename T , typename U >
bool memory::operator!= (intrusive_ptr< T > const &a, U *b) noexcept
 
template<typename T , typename U >
bool memory::operator!= (T *a, intrusive_ptr< U > const &b) noexcept
 
template<typename T , typename U >
bool memory::operator< (intrusive_ptr< T > const &a, intrusive_ptr< U > const &b) noexcept
 
template<typename T , typename U >
bool memory::operator< (intrusive_ptr< T > const &a, U *b) noexcept
 
template<typename T , typename U >
bool memory::operator< (T *a, intrusive_ptr< U > const &b) noexcept
 
template<typename T , typename U >
bool memory::operator<= (intrusive_ptr< T > const &a, intrusive_ptr< U > const &b) noexcept
 
template<typename T , typename U >
bool memory::operator<= (intrusive_ptr< T > const &a, U *b) noexcept
 
template<typename T , typename U >
bool memory::operator<= (T *a, intrusive_ptr< U > const &b) noexcept
 
template<typename T , typename U >
bool memory::operator> (intrusive_ptr< T > const &a, intrusive_ptr< U > const &b) noexcept
 
template<typename T , typename U >
bool memory::operator> (intrusive_ptr< T > const &a, U *b) noexcept
 
template<typename T , typename U >
bool memory::operator> (T *a, intrusive_ptr< U > const &b) noexcept
 
template<typename T , typename U >
bool memory::operator>= (intrusive_ptr< T > const &a, intrusive_ptr< U > const &b) noexcept
 
template<typename T , typename U >
bool memory::operator>= (intrusive_ptr< T > const &a, U *b) noexcept
 
template<typename T , typename U >
bool memory::operator>= (T *a, intrusive_ptr< U > const &b) noexcept
 
template<typename T >
bool memory::operator== (intrusive_ptr< T > const &p, std::nullptr_t) noexcept
 
template<typename T >
bool memory::operator== (std::nullptr_t, intrusive_ptr< T > const &p) noexcept
 
template<typename T >
bool memory::operator!= (intrusive_ptr< T > const &p, std::nullptr_t) noexcept
 
template<typename T >
bool memory::operator!= (std::nullptr_t, intrusive_ptr< T > const &p) noexcept
 
template<typename T >
bool memory::operator< (intrusive_ptr< T > const &p, std::nullptr_t) noexcept
 
template<typename T >
bool memory::operator< (std::nullptr_t, intrusive_ptr< T > const &p) noexcept
 
template<typename T >
bool memory::operator<= (intrusive_ptr< T > const &p, std::nullptr_t) noexcept
 
template<typename T >
bool memory::operator<= (std::nullptr_t, intrusive_ptr< T > const &p) noexcept
 
template<typename T >
bool memory::operator> (intrusive_ptr< T > const &p, std::nullptr_t) noexcept
 
template<typename T >
bool memory::operator> (std::nullptr_t, intrusive_ptr< T > const &p) noexcept
 
template<typename T >
bool memory::operator>= (intrusive_ptr< T > const &p, std::nullptr_t) noexcept
 
template<typename T >
bool memory::operator>= (std::nullptr_t, intrusive_ptr< T > const &p) noexcept
 
template<typename T >
void memory::swap (intrusive_ptr< T > &lhs, intrusive_ptr< T > &rhs)
 
template<typename T >
T * memory::get_pointer (intrusive_ptr< T > const &p)
 
template<typename T , typename U >
intrusive_ptr< T > memory::static_pointer_cast (intrusive_ptr< U > const &p)
 
template<typename T , typename U >
intrusive_ptr< T > memory::const_pointer_cast (intrusive_ptr< U > const &p)
 
template<typename E , typename T , typename Y >
std::basic_ostream< E, T > & memory::operator<< (std::basic_ostream< E, T > &os, intrusive_ptr< Y > const &p)
 

Macro Definition Documentation

◆ LIBCOPP_UTIL_INTRUSIVE_PTR_ATOMIC_TYPE

#define LIBCOPP_UTIL_INTRUSIVE_PTR_ATOMIC_TYPE
Value:
LIBCOPP_COPP_NAMESPACE_ID::util::lock::atomic_int_type< \
LIBCOPP_COPP_NAMESPACE_ID::util::lock::unsafe_int_type<size_t> >

Definition at line 371 of file intrusive_ptr.h.

◆ LIBCOPP_UTIL_INTRUSIVE_PTR_REF_FN_DECL

#define LIBCOPP_UTIL_INTRUSIVE_PTR_REF_FN_DECL (   T)
Value:
void intrusive_ptr_add_ref(T *p); \
void intrusive_ptr_release(T *p);

Definition at line 386 of file intrusive_ptr.h.

◆ LIBCOPP_UTIL_INTRUSIVE_PTR_REF_FN_DEFI

#define LIBCOPP_UTIL_INTRUSIVE_PTR_REF_FN_DEFI (   T)
Value:
void intrusive_ptr_add_ref(T *p) { \
if (nullptr != p) { \
++p->intrusive_ref_counter_; \
} \
} \
void intrusive_ptr_release(T *p) { \
if (nullptr == p) { \
return; \
} \
assert(p->intrusive_ref_counter_.load() > 0); \
size_t ref = --p->intrusive_ref_counter_; \
if (0 == ref) { \
delete p; \
} \
}

Definition at line 392 of file intrusive_ptr.h.

◆ LIBCOPP_UTIL_INTRUSIVE_PTR_REF_MEMBER_DECL

#define LIBCOPP_UTIL_INTRUSIVE_PTR_REF_MEMBER_DECL (   T)
Value:
\
private: \
LIBCOPP_UTIL_INTRUSIVE_PTR_ATOMIC_TYPE intrusive_ref_counter_; \
friend void intrusive_ptr_add_ref(T *p); \
friend void intrusive_ptr_release(T *p); \
\
public: \
const size_t use_count() const { return intrusive_ref_counter_.load(); }
#define LIBCOPP_UTIL_INTRUSIVE_PTR_ATOMIC_TYPE

Definition at line 376 of file intrusive_ptr.h.

◆ LIBCOPP_UTIL_INTRUSIVE_PTR_REF_MEMBER_INIT

#define LIBCOPP_UTIL_INTRUSIVE_PTR_REF_MEMBER_INIT ( )    this->intrusive_ref_counter_.store(0)

Definition at line 390 of file intrusive_ptr.h.