1 #ifndef LIBJMMCG_CORE_SHARED_PTR_HPP
2 #define LIBJMMCG_CORE_SHARED_PTR_HPP
28 template<
class,
class>
class slist;
43 template<
class>
class AtCtr=LkT::
template atomic_counter_type
48 using value_type=
typename base_t::value_type;
49 using atomic_ctr_t=AtCtr<value_type>;
50 using lock_traits=LkT;
67 static_assert((
std::is_integral<
typename atomic_ctr_t::value_type>::value &&
std::is_signed<
typename atomic_ctr_t::value_type>::value),
"The input type must be a signed integral type as defined in 3.9.1 of the Standard.");
79 value_type
sp_count()
const noexcept(
true)
override final {
83 const typename atomic_ctr_t::value_type ret=++ctr_;
90 bool __fastcall operator<(
const value_type v)
const noexcept(
true)
override {
93 bool __fastcall operator>(
const value_type v)
const noexcept(
true)
override {
96 bool __fastcall operator>=(
const value_type v)
const noexcept(
true)
override final {
114 mutable atomic_ctr_t ctr_;
132 using element_type=value_type;
133 using lock_traits=LkT;
138 using atomic_ptr_t=
typename lock_traits::
template atomic<value_type *>;
141 using ctr_type=
typename V::atomic_ctr_t;
142 using exception_type=
typename lock_traits::exception_type;
147 using deleter_t=
typename value_type::deleter_t;
152 using no_ref_counting=
typename lock_traits::
template noop_atomic_ctr<
typename ctr_type::value_type>;
158 using no_deletion=
noop_dtor<
typename value_type::deleter_t::element_type>;
169 BOOST_MPL_ASSERT((
std::is_base_of<base_ctr_type, value_type>));
170 static_assert(!
std::is_same<base_ctr_type, no_ref_counting>::value ||
std::is_same<deleter_t, no_deletion>::value,
"If not refcounted, then the object must not have a defined deleter, as it should be stack-based.");
175 atomic_ptr_t
__fastcall release()
noexcept(
true);
188 template<
class V1>
explicit __stdcall
194 shared_ptr(atomic_ptr_t
const &ptr)
noexcept(
true);
198 template<
class V1>
explicit __stdcall
203 template<
class V1,
template<
class>
class At>
explicit __stdcall
209 shared_ptr(
std::unique_ptr<value_type, deleter_t> &ptr)
noexcept(
true);
213 template<
class V1>
explicit __stdcall
214 shared_ptr(
std::unique_ptr<V1,
typename V1::deleter_t> &ptr)
noexcept(
true);
219 shared_ptr(
std::unique_ptr<value_type, deleter_t> &&ptr)
noexcept(
true);
223 template<
class V1>
explicit __stdcall
224 shared_ptr(
std::unique_ptr<V1,
typename V1::deleter_t> &&ptr)
noexcept(
true);
254 template<
class V2,
class LkT2>
void
261 template<
class V2,
class LkT2>
void
270 reset()
noexcept(
true);
272 constexpr bool __fastcall
274 constexpr bool __fastcall
276 constexpr bool __fastcall
277 operator<(
const shared_ptr &s)
const noexcept(
true);
278 constexpr bool __fastcall
281 operator bool()
const noexcept(
true);
283 constexpr const atomic_ptr_t &
__fastcall
284 get()
const noexcept(
true);
285 atomic_ptr_t &
__fastcall
286 get()
noexcept(
true);
287 constexpr const value_type &
__fastcall
289 value_type &
__fastcall
291 constexpr value_type
const *
__fastcall
293 value_type *
__fastcall