libcopp 2.3.1
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Data Structures | Namespaces | Enumerations | Functions | Variables
rc_ptr.h File Reference
#include <cstdint>
#include <functional>
#include <memory>
#include <ostream>
#include <type_traits>
#include <utility>
#include "libcopp/utils/config/compile_optimize.h"
#include "libcopp/utils/config/libcopp_build_features.h"
#include "libcopp/utils/memory/allocator_ptr.h"
#include "libcopp/utils/nostd/type_traits.h"
#include "libcopp/utils/config/stl_include_prefix.h"
#include "libcopp/utils/config/stl_include_suffix.h"
Include dependency graph for rc_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::__rc_ptr_counted_data_base
 
class  memory::__rc_ptr_counted_data_default< T >
 Template class definition for reference-counted. More...
 
class  memory::__rc_ptr_counted_data_inplace< T >
 Template class definition for reference-counted.(inplacement) More...
 
class  memory::__rc_ptr_counted_data_inplace_alloc< T, Alloc >
 Template class definition for reference-counted with allocator.(inplacement) More...
 
class  memory::__rc_ptr_counted_data_with_deleter< T, Deleter >
 Template class definition for reference-counted with deletor. More...
 
class  memory::__rc_ptr_counted_data_with_deleter_allocator< T, Deleter, Alloc >
 Template class definition for reference-counted with deletor and allocator. More...
 
struct  memory::__strong_rc_default_alloc_shared_tag< T >
 
struct  memory::__strong_rc_with_alloc_shared_tag< T >
 
class  memory::__strong_rc_counter< T >
 
struct  memory::__strong_rc_counter< T >::__not_alloc_shared_tag< class >
 
struct  memory::__strong_rc_counter< T >::__not_alloc_shared_tag< __strong_rc_default_alloc_shared_tag< Y > >
 
struct  memory::__strong_rc_counter< T >::__not_alloc_shared_tag< __strong_rc_with_alloc_shared_tag< Y > >
 
class  memory::__weak_rc_counter< T >
 
class  memory::strong_rc_ptr_access< T, bool, bool >
 Base class to mantain all shared APIs. More...
 
class  memory::strong_rc_ptr_access< T, false, true >
 A helper class that used to access internal APIs for void type. More...
 
class  memory::strong_rc_ptr_access< T, true, false >
 
class  memory::strong_rc_ptr< T >
 A std::shared_ptr replacement that is more lightweight and do not use atomic operation for reference counting. More...
 
struct  memory::__strong_rc_ptr_compare_common_type< T1, T2, true >
 
struct  memory::__strong_rc_ptr_compare_common_type< T1, T2, false >
 
class  memory::weak_rc_ptr< T >
 A std::weak_ptr replacement that is more lightweight and do not use atomic operation for reference counting. More...
 
class  memory::enable_shared_rc_from_this< T >
 
struct  std::hash< LIBCOPP_COPP_NAMESPACE_ID::memory::strong_rc_ptr< T > >
 Support std::hash for strong_rc_ptr. More...
 
struct  memory::compat_strong_ptr_function_trait< compat_strong_ptr_mode::kStrongRc >
 
struct  memory::compat_strong_ptr_function_trait< compat_strong_ptr_mode::kStl >
 
struct  memory::compat_strong_ptr_type_trait< T, PtrMode >
 A simple helper trait class to switch between strong_rc_ptr and std::shared_ptr. More...
 

Namespaces

namespace  memory
 
namespace  std
 STL namespace.
 

Enumerations

enum class  memory::compat_strong_ptr_mode : int8_t { memory::kStrongRc = 0 , memory::kStl = 1 }
 Helper class to switch between strong_rc_ptr and std::shared_ptr. More...
 

Functions

template<class T1 , class T2 , class T3 >
LIBCOPP_COPP_API_HEAD_ONLY void memory::__enable_shared_from_this_with (const __strong_rc_counter< T1 > *__n, const T2 *__py, const enable_shared_rc_from_this< T3 > *__p)
 A helper class that used to inject datas for classes that inherit enable_shared_rc_from_this.
 
template<class T1 , class T2 , class T3 , size_t T3SIZE>
LIBCOPP_COPP_API_HEAD_ONLY void memory::__enable_shared_from_this_with (const __strong_rc_counter< T1 > *__n, const T2 *__py, const enable_shared_rc_from_this< T3[T3SIZE]> *__p)
 
LIBCOPP_COPP_API_HEAD_ONLY void memory::__enable_shared_from_this_with (...)
 
template<class T1 , class T2 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator== (const strong_rc_ptr< T1 > &l, const strong_rc_ptr< T2 > &r) noexcept
 
template<class T1 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator== (const strong_rc_ptr< T1 > &l, ::std::nullptr_t) noexcept
 
template<class T1 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator== (::std::nullptr_t, const strong_rc_ptr< T1 > &r) noexcept
 
template<class T1 , class T2 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator!= (const strong_rc_ptr< T1 > &l, const strong_rc_ptr< T2 > &r) noexcept
 
template<class T1 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator!= (const strong_rc_ptr< T1 > &l, ::std::nullptr_t) noexcept
 
template<class T1 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator!= (::std::nullptr_t, const strong_rc_ptr< T1 > &r) noexcept
 
template<class T1 , class T2 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator< (const strong_rc_ptr< T1 > &l, const strong_rc_ptr< T2 > &r) noexcept
 
template<class T1 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator< (const strong_rc_ptr< T1 > &l, ::std::nullptr_t) noexcept
 
template<class T1 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator< (::std::nullptr_t, const strong_rc_ptr< T1 > &r) noexcept
 
template<class T1 , class T2 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator> (const strong_rc_ptr< T1 > &l, const strong_rc_ptr< T2 > &r) noexcept
 
template<class T1 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator> (const strong_rc_ptr< T1 > &l, ::std::nullptr_t) noexcept
 
template<class T1 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator> (::std::nullptr_t, const strong_rc_ptr< T1 > &r) noexcept
 
template<class T1 , class T2 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator<= (const strong_rc_ptr< T1 > &l, const strong_rc_ptr< T2 > &r) noexcept
 
template<class T1 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator<= (const strong_rc_ptr< T1 > &l, ::std::nullptr_t) noexcept
 
template<class T1 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator<= (::std::nullptr_t, const strong_rc_ptr< T1 > &r) noexcept
 
template<class T1 , class T2 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator>= (const strong_rc_ptr< T1 > &l, const strong_rc_ptr< T2 > &r) noexcept
 
template<class T1 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator>= (const strong_rc_ptr< T1 > &l, ::std::nullptr_t) noexcept
 
template<class T1 >
LIBCOPP_COPP_API_HEAD_ONLY bool memory::operator>= (::std::nullptr_t, const strong_rc_ptr< T1 > &r) noexcept
 
template<class T , class... TArgs>
nostd::enable_if_t<!::std::is_array< T >::value, strong_rc_ptr< T > > memory::make_strong_rc (TArgs &&... args)
 A std::make_shared replacement for strong_rc_ptr(non-array).
 
template<class T , class... TArgs>
nostd::enable_if_t< nostd::is_bounded_array< T >::value, strong_rc_ptr< T > > memory::make_strong_rc (TArgs &&... args)
 A std::make_shared replacement for strong_rc_ptr(bounded array).
 
template<class T , class Alloc , class... TArgs>
nostd::enable_if_t<!::std::is_array< T >::value, strong_rc_ptr< T > > memory::allocate_strong_rc (const Alloc &alloc, TArgs &&... args)
 A std::allocate_shared (C++20) replacement for strong_rc_ptr(non-array).
 
template<class T , class Alloc , class... TArgs>
nostd::enable_if_t< nostd::is_bounded_array< T >::value, strong_rc_ptr< T > > memory::allocate_strong_rc (const Alloc &alloc, TArgs &&... args)
 A std::allocate_shared (C++20) replacement for strong_rc_ptr(bounded array).
 
template<class T , class Y >
strong_rc_ptr< T > memory::static_pointer_cast (const strong_rc_ptr< Y > &r) noexcept
 A std::static_pointer_cast replacement for strong_rc_ptr.
 
template<class T , class Y >
strong_rc_ptr< T > memory::const_pointer_cast (const strong_rc_ptr< Y > &r) noexcept
 A std::const_pointer_cast replacement for strong_rc_ptr.
 
template<class T >
LIBCOPP_COPP_API_HEAD_ONLY void std::swap (LIBCOPP_COPP_NAMESPACE_ID::memory::strong_rc_ptr< T > &a, LIBCOPP_COPP_NAMESPACE_ID::memory::strong_rc_ptr< T > &b) noexcept
 Support std::swap for strong_rc_ptr.
 
template<class CharT , class TraitT , class T >
LIBCOPP_COPP_API_HEAD_ONLY std::basic_ostream< CharT, TraitT > & std::operator<< (std::basic_ostream< CharT, TraitT > &__os, const LIBCOPP_COPP_NAMESPACE_ID::memory::strong_rc_ptr< T > &__p)
 Support std::basic_ostream for strong_rc_ptr.
 

Variables

template<class T >
class LIBCOPP_COPP_API_HEAD_ONLY memory::weak_rc_ptr
 
template<class T >
class LIBCOPP_COPP_API_HEAD_ONLY memory::strong_rc_ptr
 
template<class T >
class LIBCOPP_COPP_API_HEAD_ONLY memory::enable_shared_rc_from_this
 
template<class T >
class LIBCOPP_COPP_API_HEAD_ONLY memory::__weak_rc_counter
 
template<compat_strong_ptr_mode >
struct LIBCOPP_COPP_API_HEAD_ONLY memory::compat_strong_ptr_function_trait
 Helper trait class to switch between strong_rc_ptr and std::shared_ptr.