5#include <libcopp/utils/config/libcopp_build_features.h>
23LIBCOPP_COPP_NAMESPACE_BEGIN
26template <
class T,
class... TARGS,
typename std::enable_if<!std::is_array<T>::value,
int>::type = 0>
28 return std::unique_ptr<T>(
new T(std::forward<TARGS>(args)...));
31template <class T, typename std::enable_if<std::is_array<T>::value && std::extent<T>::value == 0,
int>::type = 0>
33 using TELEM =
typename std::remove_extent<T>::type;
34 return std::unique_ptr<T>(
new TELEM[sz]());
37template <
class T,
class... TARGS,
typename std::enable_if<std::extent<T>::value != 0,
int>::type = 0>
56 using type = std::unique_ptr<void, small_object_optimize_storage_deleter<void> >;
63 std::unique_ptr<T, std::default_delete<T> > >::type;
71 using type = std::unique_ptr<void, small_object_optimize_storage_deleter<void> >;
78 LIBCOPP_COPP_NAMESPACE_ID::memory::default_strong_rc_ptr<T> >::type;
81template <
class T,
class TPTR>
85struct LIBCOPP_COPP_API_HEAD_ONLY
86poll_storage_base<void,
std::unique_ptr<void, small_object_optimize_storage_deleter<void> > > :
public std::true_type {
88 using ptr_type = std::unique_ptr<void, small_object_optimize_storage_deleter<void> >;
93 template <
class U,
class UDELETOR,
94 typename std::enable_if<std::is_convertible<typename std::decay<U>::type,
bool>::value,
bool>::type =
false>
96 std::unique_ptr<U, UDELETOR> &&in)
noexcept {
98 out.reset(
reinterpret_cast<void *
>(&out));
105 typename std::enable_if<std::is_convertible<typename std::decay<U>::type,
bool>::value,
bool>::type =
false>
108 out.reset(
reinterpret_cast<void *
>(&out));
116 out.reset(
reinterpret_cast<void *
>(&out));
132 r.reset(
reinterpret_cast<void *
>(&r));
134 l.reset(
reinterpret_cast<void *
>(&l));
85struct LIBCOPP_COPP_API_HEAD_ONLY {
…};
144struct LIBCOPP_COPP_API_HEAD_ONLY
poll_storage_base<T,
std::unique_ptr<T, small_object_optimize_storage_deleter<T> > >
145 :
public std::true_type {
147 using ptr_type = std::unique_ptr<T, small_object_optimize_storage_deleter<T> >;
151 memset(&out.first, 0,
sizeof(out.first));
155 template <
class U,
class UDELETOR,
156 typename std::enable_if<std::is_base_of<T, typename std::decay<U>::type>::value ||
157 std::is_convertible<typename std::decay<U>::type, T>::value,
160 std::unique_ptr<U, UDELETOR> &&in)
noexcept {
163 out.second.reset(&out.first);
166 memset(&out.first, 0,
sizeof(out.first));
171 template <class U, typename std::enable_if<std::is_base_of<T, typename std::decay<U>::type>::value ||
172 std::is_convertible<typename std::decay<U>::type, T>::value,
176 out.second.reset(&out.first);
179 template <
class... U>
181 out.first =
value_type(std::forward<U>(in)...);
182 out.second.reset(&out.first);
186 std::is_nothrow_copy_assignable<value_type>::value) {
188 out.first = in.first;
189 out.second.reset(&out.first);
192 memset(&out.first, 0,
sizeof(out.first));
202 if (!!l.second == !!r.second) {
208 r.second.reset(&r.first);
210 l.second.reset(&l.first);
216 return storage.second;
144struct LIBCOPP_COPP_API_HEAD_ONLY
poll_storage_base<T,
std::unique_ptr<T, small_object_optimize_storage_deleter<T> > > {
…};
221template <
class T,
class TPTR>
229 template <
class U,
class UDELETOR,
230 typename std::enable_if<std::is_base_of<T, typename std::decay<U>::type>::value,
bool>::type =
false>
232 std::unique_ptr<U, UDELETOR> &&in)
noexcept {
236 template <class U, typename std::enable_if<std::is_base_of<T, typename std::decay<U>::type>::value &&
240 storage_type &out, LIBCOPP_COPP_NAMESPACE_ID::memory::strong_rc_ptr<U> &&in)
noexcept {
241 out = std::move(LIBCOPP_COPP_NAMESPACE_ID::memory::static_pointer_cast<typename ptr_type::element_type>(in));
244 template <class U, typename std::enable_if<std::is_base_of<T, typename std::decay<U>::type>::value &&
248 out = std::move(::std::static_pointer_cast<typename ptr_type::element_type>(in));
251 template <
class... U>
253 std::is_nothrow_constructible<
value_type, U...>::value) {
254 out.reset(
new value_type(std::forward<U>(in)...));
268template <
class T,
class TPTR>
272struct LIBCOPP_COPP_API_HEAD_ONLY
compact_storage<T,
std::unique_ptr<T, small_object_optimize_storage_deleter<T> > >
273 :
public std::true_type {
275 using ptr_type = std::unique_ptr<T, small_object_optimize_storage_deleter<T> >;
283 memset(&out, 0,
sizeof(out));
288 template <
class U,
class UDELETOR,
289 typename std::enable_if<std::is_base_of<T, typename std::decay<U>::type>::value ||
290 std::is_convertible<typename std::decay<U>::type, T>::value,
293 std::is_nothrow_assignable<storage_type, U>::value) {
297 memset(&out, 0,
sizeof(out));
301 template <class U, typename std::enable_if<std::is_base_of<T, typename std::decay<U>::type>::value ||
302 std::is_convertible<typename std::decay<U>::type, T>::value,
305 std::is_nothrow_assignable<storage_type, U>::value) {
310 memcpy(&out, &in,
sizeof(out));
314 memcpy(&out, &in,
sizeof(out));
315 memset(&in, 0,
sizeof(in));
272struct LIBCOPP_COPP_API_HEAD_ONLY
compact_storage<T,
std::unique_ptr<T, small_object_optimize_storage_deleter<T> > > {
…};
331 :
public std::false_type {
333 using ptr_type = LIBCOPP_COPP_NAMESPACE_ID::memory::strong_rc_ptr<T>;
340 template <
class U,
class UDELETOR,
341 typename std::enable_if<std::is_base_of<T, typename std::decay<U>::type>::value,
bool>::type =
false>
351 typename std::enable_if<std::is_base_of<T, typename std::decay<U>::type>::value,
bool>::type =
false>
353 storage_type &out, LIBCOPP_COPP_NAMESPACE_ID::memory::strong_rc_ptr<U> &&in)
noexcept {
355 out = LIBCOPP_COPP_NAMESPACE_ID::memory::static_pointer_cast<T>(in);
361 template <
class... TARGS>
363 std::is_nothrow_constructible<T, TARGS...>::value) {
364 out = LIBCOPP_COPP_NAMESPACE_ID::memory::make_strong_rc<T>(std::forward<TARGS>(in)...);
377 return storage.get();
383struct LIBCOPP_COPP_API_HEAD_ONLY
compact_storage<T, ::std::shared_ptr<T> > :
public std::false_type {
392 template <
class U,
class UDELETOR,
393 typename std::enable_if<std::is_base_of<T, typename std::decay<U>::type>::value,
bool>::type =
false>
403 typename std::enable_if<std::is_base_of<T, typename std::decay<U>::type>::value,
bool>::type =
false>
406 out = ::std::static_pointer_cast<T>(in);
412 template <
class... TARGS>
414 std::is_nothrow_constructible<T, TARGS...>::value) {
415 out = ::std::make_shared<T>(std::forward<TARGS>(in)...);
428 return storage.get();
383struct LIBCOPP_COPP_API_HEAD_ONLY
compact_storage<T, ::std::shared_ptr<T> > :
public std::false_type {
…};
435 using type = compact_storage<T, typename compact_storage_selector<T>::type>;
438template <
class TSTORAGE,
class... TARGS>
440 typename TSTORAGE::storage_type &out,
441 TARGS &&...args)
noexcept(
noexcept(TSTORAGE::construct_storage(out, std::forward<TARGS>(args)...))) {
442 TSTORAGE::construct_storage(out, std::forward<TARGS>(args)...);
445template <
class TSTORAGE,
class... TARGS>
447 LIBCOPP_COPP_NAMESPACE_ID::memory::strong_rc_ptr<typename TSTORAGE::storage_type> &out,
448 TARGS &&...args)
noexcept(
noexcept(TSTORAGE::construct_storage(out,
449 LIBCOPP_COPP_NAMESPACE_ID::memory::make_strong_rc<
450 typename TSTORAGE::storage_type>(
451 std::forward<TARGS>(args)...)))) {
452 TSTORAGE::construct_storage(out, LIBCOPP_COPP_NAMESPACE_ID::memory::make_strong_rc<typename TSTORAGE::storage_type>(
453 std::forward<TARGS>(args)...));
456template <
class TSTORAGE,
class... TARGS>
458__make_result_value(::std::shared_ptr<typename TSTORAGE::storage_type> &out, TARGS &&...args)
noexcept(
noexcept(
459 TSTORAGE::construct_storage(out,
460 ::std::make_shared<typename TSTORAGE::storage_type>(std::forward<TARGS>(args)...)))) {
461 TSTORAGE::construct_storage(out, ::std::make_shared<typename TSTORAGE::storage_type>(std::forward<TARGS>(args)...));
458__make_result_value(::std::shared_ptr<typename TSTORAGE::storage_type> &out, TARGS &&...args)
noexcept(
noexcept( {
…}
464template <
class TOK,
class TERR,
bool is_all_trivial>
467template <
class TOK,
class TERR>
473 EN_RESULT_SUCCESS = 0,
481 return is_success() ? &success_value_ :
nullptr;
488 template <
class UOK,
class UERR>
490 template <
class TRESULT,
bool>
493 template <
class TARGS>
495 make_success_base(std::forward<TARGS>(args));
498 template <
class TARGS>
500 make_error_base(std::forward<TARGS>(args));
503 template <
class TARGS>
505 success_value_ = args;
506 mode_ = EN_RESULT_SUCCESS;
509 template <
class TARGS>
512 mode_ = EN_RESULT_ERROR;
515 inline void swap(result_base &other)
noexcept {
518 swap(success_value_, other.success_value_);
520 swap(error_value_, other.error_value_);
522 swap(mode_, other.mode_);
515 inline void swap(result_base &other)
noexcept {
…}
535template <
class TOK,
class TERR>
541 EN_RESULT_SUCCESS = 0,
555 return is_success() ? success_storage_type::unwrap(success_value_) :
nullptr;
558 return is_success() ? success_storage_type::unwrap(success_value_) :
nullptr;
561 return is_error() ? error_storage_type::unwrap(error_value_) :
nullptr;
564 return is_error() ? error_storage_type::unwrap(error_value_) :
nullptr;
568 success_storage_type::construct_default_storage(success_value_);
569 error_storage_type::construct_default_storage(error_value_);
573 result_base(result_base &&other) noexcept : mode_(EN_RESULT_NONE) {
574 success_storage_type::construct_default_storage(success_value_);
575 error_storage_type::construct_default_storage(error_value_);
588 success_storage_type::swap(success_value_, other.success_value_);
589 error_storage_type::swap(error_value_, other.error_value_);
590 swap(mode_, other.mode_);
596 template <
class UOK,
class UERR>
598 template <
class TRESULT,
bool>
601 template <
class... TARGS>
603 success_storage_type::construct_storage(std::declval<success_value_type &>(), std::forward<TARGS>(args)...))) {
605 success_storage_type::construct_storage(success_value_, std::forward<TARGS>(args)...);
606 mode_ = EN_RESULT_SUCCESS;
609 template <
class... TARGS>
611 error_storage_type::construct_storage(std::declval<error_value_type &>(), std::forward<TARGS>(args)...))) {
613 error_storage_type::construct_storage(error_value_, std::forward<TARGS>(args)...);
614 mode_ = EN_RESULT_ERROR;
617 template <
class... TARGS>
619 __make_result_value<success_storage_type>(std::declval<success_value_type &>(), std::forward<TARGS>(args)...))) {
621 __make_result_value<success_storage_type>(success_value_, std::forward<TARGS>(args)...);
622 mode_ = EN_RESULT_SUCCESS;
625 template <
class... TARGS>
627 __make_result_value<error_storage_type>(std::declval<error_value_type &>(), std::forward<TARGS>(args)...))) {
629 __make_result_value<error_storage_type>(error_value_, std::forward<TARGS>(args)...);
630 mode_ = EN_RESULT_ERROR;
634 if (EN_RESULT_SUCCESS == mode_) {
635 success_storage_type::destroy_storage(success_value_);
636 }
else if (EN_RESULT_ERROR == mode_) {
637 error_storage_type::destroy_storage(error_value_);
640 mode_ = EN_RESULT_NONE;
644 template <
class TSTORAGE,
class... TARGS>
646 noexcept(TSTORAGE::construct_storage(out, std::forward<TARGS>(args)...))) {
647 TSTORAGE::construct_storage(out, std::forward<TARGS>(args)...);
650 template <
class TSTORAGE,
class... TARGS>
652 LIBCOPP_COPP_NAMESPACE_ID::memory::default_strong_rc_ptr<typename TSTORAGE::storage_type> &out,
653 TARGS &&...args)
noexcept(
noexcept(TSTORAGE::construct_storage(out, LIBCOPP_COPP_NAMESPACE_ID::memory::
655 typename TSTORAGE::storage_type>(
656 std::forward<TARGS>(args)...)))) {
657 TSTORAGE::construct_storage(out,
658 LIBCOPP_COPP_NAMESPACE_ID::memory::default_make_strong<typename TSTORAGE::storage_type>(
659 std::forward<TARGS>(args)...));
667template <
class TRESULT,
bool>
670template <
class TRESULT>
672 using type = std::unique_ptr<TRESULT>;
674 template <
class... TARGS>
676 noexcept(std::declval<TRESULT>().make_success_base(std::forward<TARGS>(args)...))) {
677 type ret = LIBCOPP_COPP_NAMESPACE_ID::future::make_unique<TRESULT>();
679 ret->make_success_base(std::forward<TARGS>(args)...);
685 template <
class... TARGS>
687 noexcept(std::declval<TRESULT>().make_error_base(std::forward<TARGS>(args)...))) {
688 type ret = LIBCOPP_COPP_NAMESPACE_ID::future::make_unique<TRESULT>();
690 ret->make_error_base(std::forward<TARGS>(args)...);
697template <
class TRESULT>
701 template <
class... TARGS>
703 noexcept(std::declval<TRESULT>().make_success_base(std::forward<TARGS>(args)...))) {
705 ret.make_success_base(std::forward<TARGS>(args)...);
709 template <
class... TARGS>
711 noexcept(std::declval<TRESULT>().make_error_base(std::forward<TARGS>(args)...))) {
713 ret.make_error_base(std::forward<TARGS>(args)...);
718template <
class TOK,
class TERR>
720 :
public result_base<TOK, TERR, default_compact_storage<TOK>::value && default_compact_storage<TERR>::value> {
732 template <
class... TARGS>
734 noexcept(std::declval<self_type>().construct_success(std::forward<TARGS>(args)...))) {
736 ret.construct_success(std::forward<TARGS>(args)...);
740 template <
class... TARGS>
742 noexcept(std::declval<self_type>().construct_error(std::forward<TARGS>(args)...))) {
744 ret.construct_error(std::forward<TARGS>(args)...);
749 template <
class... TARGS>
751 noexcept(_make_instance_type::make_success(std::forward<TARGS>(args)...))) {
752 return _make_instance_type::make_success(std::forward<TARGS>(args)...);
755 template <
class... TARGS>
757 noexcept(_make_instance_type::make_error(std::forward<TARGS>(args)...))) {
758 return _make_instance_type::make_error(std::forward<TARGS>(args)...);
762LIBCOPP_COPP_NAMESPACE_END
LIBCOPP_UTIL_FORCEINLINE success_type * get_success() noexcept
LIBCOPP_UTIL_FORCEINLINE void make_error_base(TARGS &&...args) noexcept(noexcept(__make_result_value< error_storage_type >(std::declval< error_value_type & >(), std::forward< TARGS >(args)...)))
LIBCOPP_UTIL_FORCEINLINE friend void swap(result_base &l, result_base &r) noexcept
static LIBCOPP_UTIL_FORCEINLINE void make_object(typename TSTORAGE::storage_type &out, TARGS &&...args) noexcept(noexcept(TSTORAGE::construct_storage(out, std::forward< TARGS >(args)...)))
LIBCOPP_UTIL_FORCEINLINE bool is_success() const noexcept
typename success_storage_type::storage_type success_value_type
result_base & operator=(result_base &&other) noexcept
result_base(result_base &&other) noexcept
LIBCOPP_UTIL_FORCEINLINE void construct_success(TARGS &&...args) noexcept(noexcept(success_storage_type::construct_storage(std::declval< success_value_type & >(), std::forward< TARGS >(args)...)))
error_value_type error_value_
LIBCOPP_UTIL_FORCEINLINE const success_type * get_success() const noexcept
success_value_type success_value_
static LIBCOPP_UTIL_FORCEINLINE void make_object(LIBCOPP_COPP_NAMESPACE_ID::memory::default_strong_rc_ptr< typename TSTORAGE::storage_type > &out, TARGS &&...args) noexcept(noexcept(TSTORAGE::construct_storage(out, LIBCOPP_COPP_NAMESPACE_ID::memory::default_make_strong< typename TSTORAGE::storage_type >(std::forward< TARGS >(args)...))))
typename error_storage_type::storage_type error_value_type
typename default_compact_storage< success_type >::type success_storage_type
LIBCOPP_UTIL_FORCEINLINE void make_success_base(TARGS &&...args) noexcept(noexcept(__make_result_value< success_storage_type >(std::declval< success_value_type & >(), std::forward< TARGS >(args)...)))
LIBCOPP_UTIL_FORCEINLINE bool is_error() const noexcept
LIBCOPP_UTIL_FORCEINLINE void swap(result_base &other) noexcept
LIBCOPP_UTIL_FORCEINLINE error_type * get_error() noexcept
LIBCOPP_UTIL_FORCEINLINE void construct_error(TARGS &&...args) noexcept(noexcept(error_storage_type::construct_storage(std::declval< error_value_type & >(), std::forward< TARGS >(args)...)))
typename default_compact_storage< error_type >::type error_storage_type
LIBCOPP_UTIL_FORCEINLINE const error_type * get_error() const noexcept
LIBCOPP_UTIL_FORCEINLINE success_type * get_success() noexcept
LIBCOPP_UTIL_FORCEINLINE friend void swap(result_base &l, result_base &r) noexcept
success_type success_value_
LIBCOPP_UTIL_FORCEINLINE void make_success_base(TARGS &&args) noexcept
LIBCOPP_UTIL_FORCEINLINE bool is_error() const noexcept
LIBCOPP_UTIL_FORCEINLINE error_type * get_error() noexcept
void swap(result_base &other) noexcept
LIBCOPP_UTIL_FORCEINLINE void construct_error(TARGS &&args) noexcept
LIBCOPP_UTIL_FORCEINLINE const success_type * get_success() const noexcept
LIBCOPP_UTIL_FORCEINLINE void construct_success(TARGS &&args) noexcept
LIBCOPP_UTIL_FORCEINLINE const error_type * get_error() const noexcept
LIBCOPP_UTIL_FORCEINLINE bool is_success() const noexcept
LIBCOPP_UTIL_FORCEINLINE void make_error_base(TARGS &&args) noexcept
result_base< TOK, TERR, default_compact_storage< TOK >::value &&default_compact_storage< TERR >::value > base_type
static LIBCOPP_UTIL_FORCEINLINE storage_type make_error(TARGS &&...args) noexcept(noexcept(_make_instance_type::make_error(std::forward< TARGS >(args)...)))
_make_result_instance_helper< self_type, poll_storage_base< base_type, typename poll_storage_ptr_selector< base_type >::type >::value > _make_instance_type
typename _make_instance_type::type storage_type
static LIBCOPP_UTIL_FORCEINLINE storage_type make_success(TARGS &&...args) noexcept(noexcept(_make_instance_type::make_success(std::forward< TARGS >(args)...)))
static LIBCOPP_UTIL_FORCEINLINE self_type create_error(TARGS &&...args) noexcept(noexcept(std::declval< self_type >().construct_error(std::forward< TARGS >(args)...)))
static LIBCOPP_UTIL_FORCEINLINE self_type create_success(TARGS &&...args) noexcept(noexcept(std::declval< self_type >().construct_success(std::forward< TARGS >(args)...)))
A std::shared_ptr replacement that is more lightweight and do not use atomic operation for reference ...
#define LIBCOPP_UTIL_FORCEINLINE
#define LIBCOPP_EXPLICIT_NODISCARD_ATTR
nodiscard attribute usage: LIBCOPP_EXPLICIT_NODISCARD_ATTR int a; class LIBCOPP_EXPLICIT_NODISCARD_AT...
LIBCOPP_EXPLICIT_NODISCARD_ATTR std::unique_ptr< T > make_unique(TARGS &&...args)
static LIBCOPP_UTIL_FORCEINLINE void __make_result_value(typename TSTORAGE::storage_type &out, TARGS &&...args) noexcept(noexcept(TSTORAGE::construct_storage(out, std::forward< TARGS >(args)...)))
class LIBCOPP_COPP_API_HEAD_ONLY result_base
struct LIBCOPP_COPP_API_HEAD_ONLY _make_result_instance_helper
struct LIBCOPP_COPP_API_HEAD_ONLY compact_storage
LIBCOPP_COPP_API_HEAD_ONLY void 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.
type_traits compatiable Licensed under the MIT licenses.
#define LIBCOPP_IS_TIRVIALLY_COPYABLE_V(X)
static type make_error(TARGS &&...args) noexcept(noexcept(std::declval< TRESULT >().make_error_base(std::forward< TARGS >(args)...)))
std::unique_ptr< TRESULT > type
static type make_success(TARGS &&...args) noexcept(noexcept(std::declval< TRESULT >().make_success_base(std::forward< TARGS >(args)...)))
static LIBCOPP_UTIL_FORCEINLINE type make_success(TARGS &&...args) noexcept(noexcept(std::declval< TRESULT >().make_success_base(std::forward< TARGS >(args)...)))
static LIBCOPP_UTIL_FORCEINLINE type make_error(TARGS &&...args) noexcept(noexcept(std::declval< TRESULT >().make_error_base(std::forward< TARGS >(args)...)))
static LIBCOPP_UTIL_FORCEINLINE bool is_shared_storage() noexcept
static LIBCOPP_UTIL_FORCEINLINE void clone_storage(storage_type &out, const storage_type &in) noexcept
static LIBCOPP_UTIL_FORCEINLINE void swap(storage_type &l, storage_type &r) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, std::unique_ptr< U, UDELETOR > &&in)
static LIBCOPP_UTIL_FORCEINLINE value_type * unwrap(storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE void move_storage(storage_type &out, storage_type &&in) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, TARGS &&...in) noexcept(std::is_nothrow_constructible< T, TARGS... >::value)
static LIBCOPP_UTIL_FORCEINLINE const value_type * unwrap(const storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, LIBCOPP_COPP_NAMESPACE_ID::memory::strong_rc_ptr< U > &&in) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_default_storage(storage_type &out) noexcept
LIBCOPP_COPP_NAMESPACE_ID::memory::strong_rc_ptr< T > ptr_type
static LIBCOPP_UTIL_FORCEINLINE void destroy_storage(storage_type &out) noexcept
static LIBCOPP_UTIL_FORCEINLINE ptr_type clone_ptr(storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE void clone_storage(storage_type &out, const storage_type &in) noexcept
static LIBCOPP_UTIL_FORCEINLINE ptr_type clone_ptr(storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE value_type * unwrap(storage_type &storage) noexcept
::std::shared_ptr< T > ptr_type
static LIBCOPP_UTIL_FORCEINLINE const value_type * unwrap(const storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE void move_storage(storage_type &out, storage_type &&in) noexcept
static LIBCOPP_UTIL_FORCEINLINE void swap(storage_type &l, storage_type &r) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_default_storage(storage_type &out) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, std::unique_ptr< U, UDELETOR > &&in)
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, TARGS &&...in) noexcept(std::is_nothrow_constructible< T, TARGS... >::value)
static LIBCOPP_UTIL_FORCEINLINE void destroy_storage(storage_type &out) noexcept
static LIBCOPP_UTIL_FORCEINLINE bool is_shared_storage() noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, ::std::shared_ptr< U > &&in) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out) noexcept
static LIBCOPP_UTIL_FORCEINLINE const value_type * unwrap(const storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE value_type * unwrap(storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE void swap(storage_type &l, storage_type &r) noexcept
static LIBCOPP_UTIL_FORCEINLINE void destroy_storage(storage_type &) noexcept
static LIBCOPP_UTIL_FORCEINLINE void move_storage(storage_type &out, storage_type &&in) noexcept
static LIBCOPP_UTIL_FORCEINLINE bool is_shared_storage() noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_default_storage(storage_type &out) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, std::unique_ptr< U, UDELETOR > &&in) noexcept(std::is_nothrow_assignable< storage_type, U >::value)
static LIBCOPP_UTIL_FORCEINLINE void clone_storage(storage_type &out, const storage_type &in) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, U &&in) noexcept(std::is_nothrow_assignable< storage_type, U >::value)
std::unique_ptr< T, small_object_optimize_storage_deleter< T > > ptr_type
static LIBCOPP_UTIL_FORCEINLINE ptr_type clone_ptr(storage_type &storage) noexcept
std::unique_ptr< void, small_object_optimize_storage_deleter< void > > type
typename std::conditional< LIBCOPP_IS_TIRVIALLY_COPYABLE_V(T) &&sizeof(T)<=(sizeof(size_t)<< 2), std::unique_ptr< T, small_object_optimize_storage_deleter< T > >, LIBCOPP_COPP_NAMESPACE_ID::memory::default_strong_rc_ptr< T > >::type type
compact_storage< T, typename compact_storage_selector< T >::type > type
static LIBCOPP_UTIL_FORCEINLINE void move_storage(storage_type &out, storage_type &&in) noexcept(std::is_nothrow_copy_assignable< value_type >::value)
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, U &&...in) noexcept
static LIBCOPP_UTIL_FORCEINLINE const ptr_type & unwrap(const storage_type &storage) noexcept
std::unique_ptr< T, small_object_optimize_storage_deleter< T > > ptr_type
static LIBCOPP_UTIL_FORCEINLINE void swap(storage_type &l, storage_type &r) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_default_storage(storage_type &out) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, std::unique_ptr< U, UDELETOR > &&in) noexcept
std::pair< T, ptr_type > storage_type
static LIBCOPP_UTIL_FORCEINLINE void reset(storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE ptr_type & unwrap(storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, U &&in) noexcept
static LIBCOPP_UTIL_FORCEINLINE void reset(storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, U &&in) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_default_storage(storage_type &out) noexcept
static LIBCOPP_UTIL_FORCEINLINE void swap(storage_type &l, storage_type &r) noexcept
static LIBCOPP_UTIL_FORCEINLINE const ptr_type & unwrap(const storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE ptr_type & unwrap(storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, std::unique_ptr< U, UDELETOR > &&in) noexcept
std::unique_ptr< void, small_object_optimize_storage_deleter< void > > ptr_type
static LIBCOPP_UTIL_FORCEINLINE void move_storage(storage_type &out, storage_type &&in) noexcept
static LIBCOPP_UTIL_FORCEINLINE void move_storage(storage_type &out, storage_type &&in) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, std::unique_ptr< U, UDELETOR > &&in) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, LIBCOPP_COPP_NAMESPACE_ID::memory::strong_rc_ptr< U > &&in) noexcept
static LIBCOPP_UTIL_FORCEINLINE void swap(storage_type &l, storage_type &r) noexcept
static LIBCOPP_UTIL_FORCEINLINE const ptr_type & unwrap(const storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE void reset(storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, U &&...in) noexcept(std::is_nothrow_constructible< value_type, U... >::value)
static LIBCOPP_UTIL_FORCEINLINE void construct_default_storage(storage_type &out) noexcept
static LIBCOPP_UTIL_FORCEINLINE ptr_type & unwrap(storage_type &storage) noexcept
static LIBCOPP_UTIL_FORCEINLINE void construct_storage(storage_type &out, ::std::shared_ptr< U > &&in) noexcept
std::unique_ptr< void, small_object_optimize_storage_deleter< void > > type
typename std::conditional< LIBCOPP_IS_TIRVIALLY_COPYABLE_V(T) &&sizeof(T)<(sizeof(size_t)<< 2), std::unique_ptr< T, small_object_optimize_storage_deleter< T > >, std::unique_ptr< T, std::default_delete< T > > >::type type
LIBCOPP_UTIL_FORCEINLINE void operator()(T *) const noexcept
LIBCOPP_UTIL_FORCEINLINE void operator()(U *) const noexcept