libcopp  2.2.0
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/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  util::intrusive_ptr< T >
 

Namespaces

 util
 

Macros

#define LIBCOPP_UTIL_INTRUSIVE_PTR_ATOMIC_TYPE   LIBCOPP_COPP_NAMESPACE_ID::util::lock::atomic_int_type<size_t>
 
#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 util::operator== (intrusive_ptr< T > const &a, intrusive_ptr< U > const &b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator== (intrusive_ptr< T > const &a, U *b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator== (T *a, intrusive_ptr< U > const &b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator!= (intrusive_ptr< T > const &a, intrusive_ptr< U > const &b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator!= (intrusive_ptr< T > const &a, U *b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator!= (T *a, intrusive_ptr< U > const &b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator< (intrusive_ptr< T > const &a, intrusive_ptr< U > const &b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator< (intrusive_ptr< T > const &a, U *b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator< (T *a, intrusive_ptr< U > const &b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator<= (intrusive_ptr< T > const &a, intrusive_ptr< U > const &b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator<= (intrusive_ptr< T > const &a, U *b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator<= (T *a, intrusive_ptr< U > const &b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator> (intrusive_ptr< T > const &a, intrusive_ptr< U > const &b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator> (intrusive_ptr< T > const &a, U *b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator> (T *a, intrusive_ptr< U > const &b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator>= (intrusive_ptr< T > const &a, intrusive_ptr< U > const &b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator>= (intrusive_ptr< T > const &a, U *b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T , typename U >
bool util::operator>= (T *a, intrusive_ptr< U > const &b) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T >
bool util::operator== (intrusive_ptr< T > const &p, std::nullptr_t) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T >
bool util::operator== (std::nullptr_t, intrusive_ptr< T > const &p) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T >
bool util::operator!= (intrusive_ptr< T > const &p, std::nullptr_t) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T >
bool util::operator!= (std::nullptr_t, intrusive_ptr< T > const &p) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T >
bool util::operator< (intrusive_ptr< T > const &p, std::nullptr_t) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T >
bool util::operator< (std::nullptr_t, intrusive_ptr< T > const &p) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T >
bool util::operator<= (intrusive_ptr< T > const &p, std::nullptr_t) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T >
bool util::operator<= (std::nullptr_t, intrusive_ptr< T > const &p) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T >
bool util::operator> (intrusive_ptr< T > const &p, std::nullptr_t) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T >
bool util::operator> (std::nullptr_t, intrusive_ptr< T > const &p) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T >
bool util::operator>= (intrusive_ptr< T > const &p, std::nullptr_t) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T >
bool util::operator>= (std::nullptr_t, intrusive_ptr< T > const &p) LIBCOPP_MACRO_NOEXCEPT
 
template<typename T >
void util::swap (intrusive_ptr< T > &lhs, intrusive_ptr< T > &rhs)
 
template<typename T >
T * util::get_pointer (intrusive_ptr< T > const &p)
 
template<typename T , typename U >
intrusive_ptr< T > util::static_pointer_cast (intrusive_ptr< U > const &p)
 
template<typename T , typename U >
intrusive_ptr< T > util::const_pointer_cast (intrusive_ptr< U > const &p)
 
template<typename E , typename T , typename Y >
std::basic_ostream< E, T > & util::operator<< (std::basic_ostream< E, T > &os, intrusive_ptr< Y > const &p)
 

Detailed Description

Licensed under the MIT licenses.

Version
1.0
Author
OWenT, owt50.nosp@m.0813.nosp@m.7@liv.nosp@m.e.co.nosp@m.m
Date
2017.05.18 @history

Definition in file intrusive_ptr.h.

Macro Definition Documentation

◆ LIBCOPP_UTIL_INTRUSIVE_PTR_ATOMIC_TYPE

#define LIBCOPP_UTIL_INTRUSIVE_PTR_ATOMIC_TYPE   LIBCOPP_COPP_NAMESPACE_ID::util::lock::atomic_int_type<size_t>

Definition at line 381 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 394 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 400 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(); }

Definition at line 384 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 398 of file intrusive_ptr.h.