forked from OctaForge/libostd
convert the remaining usage of Constant and all the remaining public traits
This commit is contained in:
parent
8a1671f6ea
commit
5902299a1d
|
@ -420,7 +420,7 @@ protected:
|
||||||
|
|
||||||
Hashtable &operator=(const Hashtable &ht) {
|
Hashtable &operator=(const Hashtable &ht) {
|
||||||
clear();
|
clear();
|
||||||
if (AllocatorPropagateOnContainerCopyAssignment<A>::value) {
|
if (AllocatorPropagateOnContainerCopyAssignment<A>) {
|
||||||
if ((get_cpalloc() != ht.get_cpalloc()) && p_size) {
|
if ((get_cpalloc() != ht.get_cpalloc()) && p_size) {
|
||||||
allocator_deallocate(get_cpalloc(),
|
allocator_deallocate(get_cpalloc(),
|
||||||
p_data.first(), p_size + 1);
|
p_data.first(), p_size + 1);
|
||||||
|
@ -443,7 +443,7 @@ protected:
|
||||||
swap_adl(p_unused, ht.p_unused);
|
swap_adl(p_unused, ht.p_unused);
|
||||||
swap_adl(p_data.first(), ht.p_data.first());
|
swap_adl(p_data.first(), ht.p_data.first());
|
||||||
swap_adl(p_data.second().second(), ht.p_data.second().second());
|
swap_adl(p_data.second().second(), ht.p_data.second().second());
|
||||||
if (AllocatorPropagateOnContainerMoveAssignment<A>::value)
|
if (AllocatorPropagateOnContainerMoveAssignment<A>)
|
||||||
swap_adl(p_data.second().first(), ht.p_data.second().first());
|
swap_adl(p_data.second().first(), ht.p_data.second().first());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,7 @@ protected:
|
||||||
swap_adl(p_unused, ht.p_unused);
|
swap_adl(p_unused, ht.p_unused);
|
||||||
swap_adl(p_data.first(), ht.p_data.first());
|
swap_adl(p_data.first(), ht.p_data.first());
|
||||||
swap_adl(p_data.second().second(), ht.p_data.second().second());
|
swap_adl(p_data.second().second(), ht.p_data.second().second());
|
||||||
if (AllocatorPropagateOnContainerSwap<A>::value)
|
if (AllocatorPropagateOnContainerSwap<A>)
|
||||||
swap_adl(p_data.second().first(), ht.p_data.second().first());
|
swap_adl(p_data.second().first(), ht.p_data.second().first());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
131
ostd/memory.hh
131
ostd/memory.hh
|
@ -324,18 +324,17 @@ namespace detail {
|
||||||
template<typename T, typename U, bool = IsSame<
|
template<typename T, typename U, bool = IsSame<
|
||||||
RemoveCv<PointerElement<T>>,
|
RemoveCv<PointerElement<T>>,
|
||||||
RemoveCv<PointerElement<U>>
|
RemoveCv<PointerElement<U>>
|
||||||
>> struct SameOrLessCvQualifiedBase:
|
>> constexpr bool SameOrLessCvQualifiedBase = IsConvertible<T, U>;
|
||||||
Constant<bool, IsConvertible<T, U>> {};
|
|
||||||
|
|
||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
struct SameOrLessCvQualifiedBase<T, U, false>: False {};
|
constexpr bool SameOrLessCvQualifiedBase<T, U, false> = false;
|
||||||
|
|
||||||
template<typename T, typename U, bool = IsPointer<T>
|
template<typename T, typename U, bool = IsPointer<T>
|
||||||
|| IsSame<T, U> || detail::HasElement<T>::value
|
|| IsSame<T, U> || detail::HasElement<T>::value
|
||||||
> struct SameOrLessCvQualified: SameOrLessCvQualifiedBase<T, U> {};
|
> constexpr bool SameOrLessCvQualified = SameOrLessCvQualifiedBase<T, U>;
|
||||||
|
|
||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
struct SameOrLessCvQualified<T, U, false>: False {};
|
constexpr bool SameOrLessCvQualified<T, U, false> = false;
|
||||||
} /* namespace detail */
|
} /* namespace detail */
|
||||||
|
|
||||||
template<typename T, typename D>
|
template<typename T, typename D>
|
||||||
|
@ -359,23 +358,22 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename U> explicit Box(U p, EnableIf<
|
template<typename U> explicit Box(U p, EnableIf<
|
||||||
detail::SameOrLessCvQualified<U, Pointer>::value, Nat
|
detail::SameOrLessCvQualified<U, Pointer>, Nat
|
||||||
> = Nat()): p_stor(p, D()) {
|
> = Nat()): p_stor(p, D()) {
|
||||||
static_assert(!IsPointer<D>, "Box constructed with null fptr deleter");
|
static_assert(!IsPointer<D>, "Box constructed with null fptr deleter");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename U> Box(U p, Conditional<
|
template<typename U> Box(U p, Conditional<
|
||||||
IsReference<D>, D, AddLvalueReference<const D>
|
IsReference<D>, D, AddLvalueReference<const D>
|
||||||
> d, EnableIf<detail::SameOrLessCvQualified<U, Pointer>::value,
|
> d, EnableIf<detail::SameOrLessCvQualified<U, Pointer>, Nat> = Nat()):
|
||||||
Nat> = Nat()): p_stor(p, d) {}
|
p_stor(p, d) {}
|
||||||
|
|
||||||
Box(Nullptr, Conditional<IsReference<D>, D, AddLvalueReference<const D>> d):
|
Box(Nullptr, Conditional<IsReference<D>, D, AddLvalueReference<const D>> d):
|
||||||
p_stor(nullptr, d) {}
|
p_stor(nullptr, d) {}
|
||||||
|
|
||||||
template<typename U> Box(U p, RemoveReference<D> &&d,
|
template<typename U> Box(U p, RemoveReference<D> &&d,
|
||||||
EnableIf<
|
EnableIf<detail::SameOrLessCvQualified<U, Pointer>, Nat> = Nat()):
|
||||||
detail::SameOrLessCvQualified<U, Pointer>::value, Nat
|
p_stor(p, move(d)) {
|
||||||
> = Nat()): p_stor(p, move(d)) {
|
|
||||||
static_assert(!IsReference<D>, "rvalue deleter cannot be a ref");
|
static_assert(!IsReference<D>, "rvalue deleter cannot be a ref");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,7 +387,7 @@ public:
|
||||||
template<typename TT, typename DD>
|
template<typename TT, typename DD>
|
||||||
Box(Box<TT, DD> &&u, EnableIf<IsArray<TT>
|
Box(Box<TT, DD> &&u, EnableIf<IsArray<TT>
|
||||||
&& detail::SameOrLessCvQualified<typename Box<TT, DD>::Pointer,
|
&& detail::SameOrLessCvQualified<typename Box<TT, DD>::Pointer,
|
||||||
Pointer>::value
|
Pointer>
|
||||||
&& IsConvertible<DD, D> && (!IsReference<D> || IsSame<D, DD>)> = Nat()
|
&& IsConvertible<DD, D> && (!IsReference<D> || IsSame<D, DD>)> = Nat()
|
||||||
): p_stor(u.release(), forward<DD>(u.get_deleter())) {}
|
): p_stor(u.release(), forward<DD>(u.get_deleter())) {}
|
||||||
|
|
||||||
|
@ -402,7 +400,7 @@ public:
|
||||||
template<typename TT, typename DD>
|
template<typename TT, typename DD>
|
||||||
EnableIf<IsArray<TT>
|
EnableIf<IsArray<TT>
|
||||||
&& detail::SameOrLessCvQualified<typename Box<TT, DD>::Pointer,
|
&& detail::SameOrLessCvQualified<typename Box<TT, DD>::Pointer,
|
||||||
Pointer>::value
|
Pointer>
|
||||||
&& IsAssignable<D &, DD &&>,
|
&& IsAssignable<D &, DD &&>,
|
||||||
Box &
|
Box &
|
||||||
> operator=(Box<TT, DD> &&u) {
|
> operator=(Box<TT, DD> &&u) {
|
||||||
|
@ -438,7 +436,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename U> EnableIf<
|
template<typename U> EnableIf<
|
||||||
detail::SameOrLessCvQualified<U, Pointer>::value, void
|
detail::SameOrLessCvQualified<U, Pointer>, void
|
||||||
> reset(U p) {
|
> reset(U p) {
|
||||||
Pointer tmp = p_stor.first();
|
Pointer tmp = p_stor.first();
|
||||||
p_stor.first() = p;
|
p_stor.first() = p;
|
||||||
|
@ -762,26 +760,23 @@ namespace detail {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct PropagateOnContainerCopyAssignmentTest {
|
struct PropagateOnContainerCopyAssignmentTest {
|
||||||
template<typename U> static char test(
|
template<typename U> static char test(
|
||||||
typename U::PropagateOnContainerCopyAssignment * = 0);
|
decltype(U::PropagateOnContainerCopyAssignment) * = 0);
|
||||||
template<typename U> static int test(...);
|
template<typename U> static int test(...);
|
||||||
static constexpr bool value = (sizeof(test<T>(0)) == 1);
|
static constexpr bool value = (sizeof(test<T>(0)) == 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename A, bool = PropagateOnContainerCopyAssignmentTest<
|
template<typename A, bool = PropagateOnContainerCopyAssignmentTest<
|
||||||
A
|
A
|
||||||
>::value> struct PropagateOnContainerCopyAssignmentBase {
|
>::value> constexpr bool PropagateOnContainerCopyAssignmentBase = false;
|
||||||
using Type = False;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
struct PropagateOnContainerCopyAssignmentBase<A, true> {
|
constexpr bool PropagateOnContainerCopyAssignmentBase<A, true>
|
||||||
using Type = typename A::PropagateOnContainerCopyAssignment;
|
= A::PropagateOnContainerCopyAssignment;
|
||||||
};
|
|
||||||
} /* namespace detail */
|
} /* namespace detail */
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
using AllocatorPropagateOnContainerCopyAssignment
|
constexpr bool AllocatorPropagateOnContainerCopyAssignment
|
||||||
= typename detail::PropagateOnContainerCopyAssignmentBase<A>::Type;
|
= detail::PropagateOnContainerCopyAssignmentBase<A>;
|
||||||
|
|
||||||
/* allocator propagate on container move assignment */
|
/* allocator propagate on container move assignment */
|
||||||
|
|
||||||
|
@ -789,26 +784,23 @@ namespace detail {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct PropagateOnContainerMoveAssignmentTest {
|
struct PropagateOnContainerMoveAssignmentTest {
|
||||||
template<typename U> static char test(
|
template<typename U> static char test(
|
||||||
typename U::PropagateOnContainerMoveAssignment * = 0);
|
decltype(U::PropagateOnContainerMoveAssignment) * = 0);
|
||||||
template<typename U> static int test(...);
|
template<typename U> static int test(...);
|
||||||
static constexpr bool value = (sizeof(test<T>(0)) == 1);
|
static constexpr bool value = (sizeof(test<T>(0)) == 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename A, bool = PropagateOnContainerMoveAssignmentTest<
|
template<typename A, bool = PropagateOnContainerMoveAssignmentTest<
|
||||||
A
|
A
|
||||||
>::value> struct PropagateOnContainerMoveAssignmentBase {
|
>::value> constexpr bool PropagateOnContainerMoveAssignmentBase = false;
|
||||||
using Type = False;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
struct PropagateOnContainerMoveAssignmentBase<A, true> {
|
constexpr bool PropagateOnContainerMoveAssignmentBase<A, true>
|
||||||
using Type = typename A::PropagateOnContainerMoveAssignment;
|
= A::PropagateOnContainerMoveAssignment;
|
||||||
};
|
|
||||||
} /* namespace detail */
|
} /* namespace detail */
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
using AllocatorPropagateOnContainerMoveAssignment
|
constexpr bool AllocatorPropagateOnContainerMoveAssignment
|
||||||
= typename detail::PropagateOnContainerMoveAssignmentBase<A>::Type;
|
= detail::PropagateOnContainerMoveAssignmentBase<A>;
|
||||||
|
|
||||||
/* allocator propagate on container swap */
|
/* allocator propagate on container swap */
|
||||||
|
|
||||||
|
@ -816,49 +808,42 @@ namespace detail {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct PropagateOnContainerSwapTest {
|
struct PropagateOnContainerSwapTest {
|
||||||
template<typename U> static char test(
|
template<typename U> static char test(
|
||||||
typename U::PropagateOnContainerSwap * = 0);
|
decltype(U::PropagateOnContainerSwap) * = 0);
|
||||||
template<typename U> static int test(...);
|
template<typename U> static int test(...);
|
||||||
static constexpr bool value = (sizeof(test<T>(0)) == 1);
|
static constexpr bool value = (sizeof(test<T>(0)) == 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename A, bool = PropagateOnContainerSwapTest<A>::value>
|
template<typename A, bool = PropagateOnContainerSwapTest<A>::value>
|
||||||
struct PropagateOnContainerSwapBase {
|
constexpr bool PropagateOnContainerSwapBase = false;
|
||||||
using Type = False;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
struct PropagateOnContainerSwapBase<A, true> {
|
constexpr bool PropagateOnContainerSwapBase<A, true>
|
||||||
using Type = typename A::PropagateOnContainerSwap;
|
= A::PropagateOnContainerSwap;
|
||||||
};
|
|
||||||
} /* namespace detail */
|
} /* namespace detail */
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
using AllocatorPropagateOnContainerSwap
|
constexpr bool AllocatorPropagateOnContainerSwap
|
||||||
= typename detail::PropagateOnContainerSwapBase<A>::Type;
|
= detail::PropagateOnContainerSwapBase<A>;
|
||||||
|
|
||||||
/* allocator is always equal */
|
/* allocator is always equal */
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct IsAlwaysEqualTest {
|
struct IsAlwaysEqualTest {
|
||||||
template<typename U> static char test(typename U::IsAlwaysEqual * = 0);
|
template<typename U> static char test(decltype(U::IsAlwaysEqual) * = 0);
|
||||||
template<typename U> static int test(...);
|
template<typename U> static int test(...);
|
||||||
static constexpr bool value = (sizeof(test<T>(0)) == 1);
|
static constexpr bool value = (sizeof(test<T>(0)) == 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename A, bool = IsAlwaysEqualTest<A>::value>
|
template<typename A, bool = IsAlwaysEqualTest<A>::value>
|
||||||
struct IsAlwaysEqualBase {
|
constexpr bool IsAlwaysEqualBase = IsEmpty<A>;
|
||||||
using Type = Constant<bool, IsEmpty<A>>;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
struct IsAlwaysEqualBase<A, true> {
|
constexpr bool IsAlwaysEqualBase<A, true> = A::IsAlwaysEqual;
|
||||||
using Type = typename A::IsAlwaysEqual;
|
|
||||||
};
|
|
||||||
} /* namespace detail */
|
} /* namespace detail */
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
using AllocatorIsAlwaysEqual = typename detail::IsAlwaysEqualBase<A>::Type;
|
constexpr bool AllocatorIsAlwaysEqual = detail::IsAlwaysEqualBase<A>;
|
||||||
|
|
||||||
/* allocator allocate */
|
/* allocator allocate */
|
||||||
|
|
||||||
|
@ -878,12 +863,11 @@ namespace detail {
|
||||||
-> False;
|
-> False;
|
||||||
|
|
||||||
template<typename A, typename S, typename CVP>
|
template<typename A, typename S, typename CVP>
|
||||||
struct AllocateHintTest: Constant<bool,
|
constexpr bool AllocateHintTest
|
||||||
IsSame<decltype(allocate_hint_test(declval<A>(),
|
= IsSame<decltype(allocate_hint_test(declval<A>(),
|
||||||
declval<S>(),
|
declval<S>(),
|
||||||
declval<CVP>())), True
|
declval<CVP>())), True
|
||||||
>
|
>;
|
||||||
> {};
|
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
inline AllocatorPointer<A> allocate(A &a, AllocatorSize<A> n,
|
inline AllocatorPointer<A> allocate(A &a, AllocatorSize<A> n,
|
||||||
|
@ -904,10 +888,9 @@ template<typename A>
|
||||||
inline AllocatorPointer<A>
|
inline AllocatorPointer<A>
|
||||||
allocator_allocate(A &a, AllocatorSize<A> n,
|
allocator_allocate(A &a, AllocatorSize<A> n,
|
||||||
AllocatorConstVoidPointer<A> h) {
|
AllocatorConstVoidPointer<A> h) {
|
||||||
return detail::allocate(a, n, h,
|
return detail::allocate(a, n, h, BoolConstant<detail::AllocateHintTest<
|
||||||
detail::AllocateHintTest<
|
|
||||||
A, AllocatorSize<A>, AllocatorConstVoidPointer<A>
|
A, AllocatorSize<A>, AllocatorConstVoidPointer<A>
|
||||||
>());
|
>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocator deallocate */
|
/* allocator deallocate */
|
||||||
|
@ -931,12 +914,11 @@ namespace detail {
|
||||||
-> False;
|
-> False;
|
||||||
|
|
||||||
template<typename A, typename T, typename ...Args>
|
template<typename A, typename T, typename ...Args>
|
||||||
struct ConstructTest: Constant<bool,
|
constexpr bool ConstructTest
|
||||||
IsSame< decltype(construct_test(declval<A>(),
|
= IsSame<decltype(construct_test(declval<A>(),
|
||||||
declval<T>(),
|
declval<T>(),
|
||||||
declval<Args>()...)), True
|
declval<Args>()...)), True
|
||||||
>
|
>;
|
||||||
> {};
|
|
||||||
|
|
||||||
template<typename A, typename T, typename ...Args>
|
template<typename A, typename T, typename ...Args>
|
||||||
inline void construct(True, A &a, T *p, Args &&...args) {
|
inline void construct(True, A &a, T *p, Args &&...args) {
|
||||||
|
@ -951,8 +933,8 @@ namespace detail {
|
||||||
|
|
||||||
template<typename A, typename T, typename ...Args>
|
template<typename A, typename T, typename ...Args>
|
||||||
inline void allocator_construct(A &a, T *p, Args &&...args) {
|
inline void allocator_construct(A &a, T *p, Args &&...args) {
|
||||||
detail::construct(detail::ConstructTest<A, T *, Args...>(), a, p,
|
detail::construct(BoolConstant<detail::ConstructTest<A, T *, Args...>>(),
|
||||||
forward<Args>(args)...);
|
a, p, forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocator destroy */
|
/* allocator destroy */
|
||||||
|
@ -965,9 +947,8 @@ namespace detail {
|
||||||
auto destroy_test(const A &, P &&) -> False;
|
auto destroy_test(const A &, P &&) -> False;
|
||||||
|
|
||||||
template<typename A, typename P>
|
template<typename A, typename P>
|
||||||
struct DestroyTest: Constant<bool,
|
constexpr bool DestroyTest
|
||||||
IsSame<decltype(destroy_test(declval<A>(), declval<P>())), True>
|
= IsSame<decltype(destroy_test(declval<A>(), declval<P>())), True>;
|
||||||
> {};
|
|
||||||
|
|
||||||
template<typename A, typename T>
|
template<typename A, typename T>
|
||||||
inline void destroy(True, A &a, T *p) {
|
inline void destroy(True, A &a, T *p) {
|
||||||
|
@ -982,7 +963,7 @@ namespace detail {
|
||||||
|
|
||||||
template<typename A, typename T>
|
template<typename A, typename T>
|
||||||
inline void allocator_destroy(A &a, T *p) {
|
inline void allocator_destroy(A &a, T *p) {
|
||||||
detail::destroy(detail::DestroyTest<A, T *>(), a, p);
|
detail::destroy(BoolConstant<detail::DestroyTest<A, T *>>(), a, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocator max size */
|
/* allocator max size */
|
||||||
|
@ -995,9 +976,8 @@ namespace detail {
|
||||||
auto alloc_max_size_test(const A &) -> False;
|
auto alloc_max_size_test(const A &) -> False;
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
struct AllocMaxSizeTest: Constant<bool,
|
constexpr bool AllocMaxSizeTest
|
||||||
IsSame<decltype(alloc_max_size_test(declval<A &>())), True>
|
= IsSame<decltype(alloc_max_size_test(declval<A &>())), True>;
|
||||||
> {};
|
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
inline AllocatorSize<A> alloc_max_size(True, const A &a) {
|
inline AllocatorSize<A> alloc_max_size(True, const A &a) {
|
||||||
|
@ -1012,7 +992,9 @@ namespace detail {
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
inline AllocatorSize<A> allocator_max_size(const A &a) {
|
inline AllocatorSize<A> allocator_max_size(const A &a) {
|
||||||
return detail::alloc_max_size(detail::AllocMaxSizeTest<const A>(), a);
|
return detail::alloc_max_size(BoolConstant<
|
||||||
|
detail::AllocMaxSizeTest<const A>
|
||||||
|
>(), a);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocator container copy */
|
/* allocator container copy */
|
||||||
|
@ -1025,9 +1007,8 @@ namespace detail {
|
||||||
auto alloc_copy_test(const A &) -> False;
|
auto alloc_copy_test(const A &) -> False;
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
struct AllocCopyTest: Constant<bool,
|
constexpr bool AllocCopyTest
|
||||||
IsSame<decltype(alloc_copy_test(declval<A &>())), True>
|
= IsSame<decltype(alloc_copy_test(declval<A &>())), True>;
|
||||||
> {};
|
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
inline AllocatorType<A> alloc_container_copy(True, const A &a) {
|
inline AllocatorType<A> alloc_container_copy(True, const A &a) {
|
||||||
|
@ -1042,8 +1023,8 @@ namespace detail {
|
||||||
|
|
||||||
template<typename A>
|
template<typename A>
|
||||||
inline AllocatorType<A> allocator_container_copy(const A &a) {
|
inline AllocatorType<A> allocator_container_copy(const A &a) {
|
||||||
return detail::alloc_container_copy(detail::AllocCopyTest<
|
return detail::alloc_container_copy(BoolConstant<
|
||||||
const A
|
detail::AllocCopyTest<const A>
|
||||||
>(), a);
|
>(), a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -340,7 +340,7 @@ public:
|
||||||
StringBase &operator=(const StringBase &v) {
|
StringBase &operator=(const StringBase &v) {
|
||||||
if (this == &v) return *this;
|
if (this == &v) return *this;
|
||||||
clear();
|
clear();
|
||||||
if (AllocatorPropagateOnContainerCopyAssignment<A>::value) {
|
if (AllocatorPropagateOnContainerCopyAssignment<A>) {
|
||||||
if ((p_buf.second() != v.p_buf.second()) && p_cap) {
|
if ((p_buf.second() != v.p_buf.second()) && p_cap) {
|
||||||
allocator_deallocate(p_buf.second(), p_buf.first(), p_cap);
|
allocator_deallocate(p_buf.second(), p_buf.first(), p_cap);
|
||||||
p_cap = 0;
|
p_cap = 0;
|
||||||
|
@ -360,7 +360,7 @@ public:
|
||||||
StringBase &operator=(StringBase &&v) {
|
StringBase &operator=(StringBase &&v) {
|
||||||
clear();
|
clear();
|
||||||
if (p_cap) allocator_deallocate(p_buf.second(), p_buf.first(), p_cap);
|
if (p_cap) allocator_deallocate(p_buf.second(), p_buf.first(), p_cap);
|
||||||
if (AllocatorPropagateOnContainerMoveAssignment<A>::value)
|
if (AllocatorPropagateOnContainerMoveAssignment<A>)
|
||||||
p_buf.second() = v.p_buf.second();
|
p_buf.second() = v.p_buf.second();
|
||||||
p_len = v.p_len;
|
p_len = v.p_len;
|
||||||
p_cap = v.p_cap;
|
p_cap = v.p_cap;
|
||||||
|
@ -542,7 +542,7 @@ public:
|
||||||
detail::swap_adl(p_len, v.p_len);
|
detail::swap_adl(p_len, v.p_len);
|
||||||
detail::swap_adl(p_cap, v.p_cap);
|
detail::swap_adl(p_cap, v.p_cap);
|
||||||
detail::swap_adl(p_buf.first(), v.p_buf.first());
|
detail::swap_adl(p_buf.first(), v.p_buf.first());
|
||||||
if (AllocatorPropagateOnContainerSwap<A>::value)
|
if (AllocatorPropagateOnContainerSwap<A>)
|
||||||
detail::swap_adl(p_buf.second(), v.p_buf.second());
|
detail::swap_adl(p_buf.second(), v.p_buf.second());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ public:
|
||||||
Vector &operator=(const Vector &v) {
|
Vector &operator=(const Vector &v) {
|
||||||
if (this == &v) return *this;
|
if (this == &v) return *this;
|
||||||
clear();
|
clear();
|
||||||
if (AllocatorPropagateOnContainerCopyAssignment<A>::value) {
|
if (AllocatorPropagateOnContainerCopyAssignment<A>) {
|
||||||
if (p_buf.second() != v.p_buf.second() && p_cap) {
|
if (p_buf.second() != v.p_buf.second() && p_cap) {
|
||||||
allocator_deallocate(p_buf.second(), p_buf.first(), p_cap);
|
allocator_deallocate(p_buf.second(), p_buf.first(), p_cap);
|
||||||
p_cap = 0;
|
p_cap = 0;
|
||||||
|
@ -190,7 +190,7 @@ public:
|
||||||
clear();
|
clear();
|
||||||
if (p_buf.first())
|
if (p_buf.first())
|
||||||
allocator_deallocate(p_buf.second(), p_buf.first(), p_cap);
|
allocator_deallocate(p_buf.second(), p_buf.first(), p_cap);
|
||||||
if (AllocatorPropagateOnContainerMoveAssignment<A>::value)
|
if (AllocatorPropagateOnContainerMoveAssignment<A>)
|
||||||
p_buf.second() = v.p_buf.second();
|
p_buf.second() = v.p_buf.second();
|
||||||
p_len = v.p_len;
|
p_len = v.p_len;
|
||||||
p_cap = v.p_cap;
|
p_cap = v.p_cap;
|
||||||
|
@ -414,7 +414,7 @@ public:
|
||||||
detail::swap_adl(p_len, v.p_len);
|
detail::swap_adl(p_len, v.p_len);
|
||||||
detail::swap_adl(p_cap, v.p_cap);
|
detail::swap_adl(p_cap, v.p_cap);
|
||||||
detail::swap_adl(p_buf.first(), v.p_buf.first());
|
detail::swap_adl(p_buf.first(), v.p_buf.first());
|
||||||
if (AllocatorPropagateOnContainerSwap<A>::value)
|
if (AllocatorPropagateOnContainerSwap<A>)
|
||||||
detail::swap_adl(p_buf.second(), v.p_buf.second());
|
detail::swap_adl(p_buf.second(), v.p_buf.second());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue