style update

master
Daniel Kolesa 2015-04-27 20:23:38 +01:00
parent 709bcb1362
commit 56f19204a2
4 changed files with 119 additions and 119 deletions

View File

@ -259,7 +259,7 @@ namespace octa {
struct __OctaFunctionManager; struct __OctaFunctionManager;
struct __OctaFMStorage { struct __OctaFmStorage {
__OctaFunctorData data; __OctaFunctorData data;
const __OctaFunctionManager *manager; const __OctaFunctionManager *manager;
}; };
@ -277,15 +277,15 @@ namespace octa {
}; };
} }
void (* const call_move_and_destroy)(__OctaFMStorage &lhs, void (* const call_move_and_destroy)(__OctaFmStorage &lhs,
__OctaFMStorage &&rhs); __OctaFmStorage &&rhs);
void (* const call_copy)(__OctaFMStorage &lhs, void (* const call_copy)(__OctaFmStorage &lhs,
const __OctaFMStorage &rhs); const __OctaFmStorage &rhs);
void (* const call_destroy)(__OctaFMStorage &s); void (* const call_destroy)(__OctaFmStorage &s);
template<typename T> template<typename T>
static void t_call_move_and_destroy(__OctaFMStorage &lhs, static void t_call_move_and_destroy(__OctaFmStorage &lhs,
__OctaFMStorage &&rhs) { __OctaFmStorage &&rhs) {
typedef __OctaFunctorDataManager<T> spec; typedef __OctaFunctorDataManager<T> spec;
spec::move_f(lhs.data, move(rhs.data)); spec::move_f(lhs.data, move(rhs.data));
spec::destroy_f(rhs.data); spec::destroy_f(rhs.data);
@ -293,15 +293,15 @@ namespace octa {
} }
template<typename T> template<typename T>
static void t_call_copy(__OctaFMStorage &lhs, static void t_call_copy(__OctaFmStorage &lhs,
const __OctaFMStorage &rhs) { const __OctaFmStorage &rhs) {
typedef __OctaFunctorDataManager<T> spec; typedef __OctaFunctorDataManager<T> spec;
lhs.manager = &__octa_get_default_fm<T>(); lhs.manager = &__octa_get_default_fm<T>();
spec::store_f(lhs.data, spec::get_ref(rhs.data)); spec::store_f(lhs.data, spec::get_ref(rhs.data));
} }
template<typename T> template<typename T>
static void t_call_destroy(__OctaFMStorage &s) { static void t_call_destroy(__OctaFmStorage &s) {
typedef __OctaFunctorDataManager<T> spec; typedef __OctaFunctorDataManager<T> spec;
spec::destroy_f(s.data); spec::destroy_f(s.data);
} }
@ -381,7 +381,7 @@ namespace octa {
} }
void swap(Function &f) { void swap(Function &f) {
__OctaFMStorage tmp; __OctaFmStorage tmp;
f.p_stor.manager->call_move_and_destroy(tmp, move(f.p_stor)); f.p_stor.manager->call_move_and_destroy(tmp, move(f.p_stor));
p_stor.manager->call_move_and_destroy(f.p_stor, move(p_stor)); p_stor.manager->call_move_and_destroy(f.p_stor, move(p_stor));
tmp.manager->call_move_and_destroy(p_stor, move(tmp)); tmp.manager->call_move_and_destroy(p_stor, move(tmp));
@ -391,7 +391,7 @@ namespace octa {
operator bool() const { return p_call != nullptr; } operator bool() const { return p_call != nullptr; }
private: private:
__OctaFMStorage p_stor; __OctaFmStorage p_stor;
R (*p_call)(const __OctaFunctorData &, A...); R (*p_call)(const __OctaFunctorData &, A...);
template<typename T> template<typename T>

View File

@ -105,11 +105,11 @@ namespace octa {
using rebind = typename __OctaPtrTraitsRebind<T, U>::type; using rebind = typename __OctaPtrTraitsRebind<T, U>::type;
private: private:
struct __OctaNAT {}; struct __OctaNat {};
public: public:
static T pointer_to(Conditional<IsVoid<element_type>::value, static T pointer_to(Conditional<IsVoid<element_type>::value,
__OctaNAT, element_type __OctaNat, element_type
> &r) { > &r) {
return T::pointer_to(r); return T::pointer_to(r);
} }
@ -125,11 +125,11 @@ namespace octa {
template<typename U> using rebind = U *; template<typename U> using rebind = U *;
private: private:
struct __OctaNAT {}; struct __OctaNat {};
public: public:
static T pointer_to(Conditional<IsVoid<element_type>::value, static T pointer_to(Conditional<IsVoid<element_type>::value,
__OctaNAT, element_type __OctaNat, element_type
> &r) { > &r) {
return octa::address_of(r); return octa::address_of(r);
} }
@ -191,7 +191,7 @@ namespace octa {
typedef typename __OctaPtrType<T, D>::type pointer; typedef typename __OctaPtrType<T, D>::type pointer;
private: private:
struct __OctaNAT { int x; }; struct __OctaNat { int x; };
typedef RemoveReference<D> &D_ref; typedef RemoveReference<D> &D_ref;
typedef const RemoveReference<D> &D_cref; typedef const RemoveReference<D> &D_cref;
@ -227,7 +227,7 @@ namespace octa {
&& IsConvertible<typename Box<TT, DD>::pointer, pointer>::value && IsConvertible<typename Box<TT, DD>::pointer, pointer>::value
&& IsConvertible<DD, D>::value && IsConvertible<DD, D>::value
&& (!IsReference<D>::value || IsSame<D, DD>::value) && (!IsReference<D>::value || IsSame<D, DD>::value)
> = __OctaNAT()): p_ptr(u.release()), > = __OctaNat()): p_ptr(u.release()),
p_del(forward<DD>(u.get_deleter())) {} p_del(forward<DD>(u.get_deleter())) {}
Box &operator=(Box &&u) { Box &operator=(Box &&u) {
@ -288,19 +288,19 @@ namespace octa {
}; };
template<typename T, typename U, bool = IsSame< template<typename T, typename U, bool = IsSame<
RemoveCV<typename PointerTraits<T>::element_type>, RemoveCv<typename PointerTraits<T>::element_type>,
RemoveCV<typename PointerTraits<U>::element_type> RemoveCv<typename PointerTraits<U>::element_type>
>::value> struct __OctaSameOrLessCVQualifiedBase: IsConvertible<T, U> {}; >::value> struct __OctaSameOrLessCvQualifiedBase: IsConvertible<T, U> {};
template<typename T, typename U> template<typename T, typename U>
struct __OctaSameOrLessCVQualifiedBase<T, U, false>: False {}; struct __OctaSameOrLessCvQualifiedBase<T, U, false>: False {};
template<typename T, typename U, bool = IsPointer<T>::value template<typename T, typename U, bool = IsPointer<T>::value
|| IsSame<T, U>::value || __OctaHasElementType<T>::value || IsSame<T, U>::value || __OctaHasElementType<T>::value
> struct __OctaSameOrLessCVQualified: __OctaSameOrLessCVQualifiedBase<T, U> {}; > struct __OctaSameOrLessCvQualified: __OctaSameOrLessCvQualifiedBase<T, U> {};
template<typename T, typename U> template<typename T, typename U>
struct __OctaSameOrLessCVQualified<T, U, false>: False {}; struct __OctaSameOrLessCvQualified<T, U, false>: False {};
template<typename T, typename D> template<typename T, typename D>
struct Box<T[], D> { struct Box<T[], D> {
@ -309,7 +309,7 @@ namespace octa {
typedef typename __OctaPtrType<T, D>::type pointer; typedef typename __OctaPtrType<T, D>::type pointer;
private: private:
struct __OctaNAT { int x; }; struct __OctaNat { int x; };
typedef RemoveReference<D> &D_ref; typedef RemoveReference<D> &D_ref;
typedef const RemoveReference<D> &D_cref; typedef const RemoveReference<D> &D_cref;
@ -325,24 +325,24 @@ namespace octa {
} }
template<typename U> explicit Box(U p, EnableIf< template<typename U> explicit Box(U p, EnableIf<
__OctaSameOrLessCVQualified<U, pointer>::value, __OctaNAT __OctaSameOrLessCvQualified<U, pointer>::value, __OctaNat
> = __OctaNAT()): p_ptr(p), p_del() { > = __OctaNat()): p_ptr(p), p_del() {
static_assert(!IsPointer<D>::value, static_assert(!IsPointer<D>::value,
"Box constructed with null fptr deleter"); "Box constructed with null fptr deleter");
} }
template<typename U> Box(U p, Conditional<IsReference<D>::value, template<typename U> Box(U p, Conditional<IsReference<D>::value,
D, AddLvalueReference<const D> D, AddLvalueReference<const D>
> d, EnableIf<__OctaSameOrLessCVQualified<U, pointer>::value, __OctaNAT > d, EnableIf<__OctaSameOrLessCvQualified<U, pointer>::value, __OctaNat
> = __OctaNAT()): p_ptr(p), p_del(d) {} > = __OctaNat()): p_ptr(p), p_del(d) {}
Box(nullptr_t, Conditional<IsReference<D>::value, Box(nullptr_t, Conditional<IsReference<D>::value,
D, AddLvalueReference<const D> D, AddLvalueReference<const D>
> d): p_ptr(), p_del(d) {} > d): p_ptr(), p_del(d) {}
template<typename U> Box(U p, RemoveReference<D> &&d, EnableIf< template<typename U> Box(U p, RemoveReference<D> &&d, EnableIf<
__OctaSameOrLessCVQualified<U, pointer>::value, __OctaNAT __OctaSameOrLessCvQualified<U, pointer>::value, __OctaNat
> = __OctaNAT()): p_ptr(p), p_del(move(d)) { > = __OctaNat()): p_ptr(p), p_del(move(d)) {
static_assert(!IsReference<D>::value, static_assert(!IsReference<D>::value,
"rvalue deleter cannot be a ref"); "rvalue deleter cannot be a ref");
} }
@ -356,10 +356,10 @@ namespace octa {
template<typename TT, typename DD> template<typename TT, typename DD>
Box(Box<TT, DD> &&u, EnableIf<IsArray<TT>::value Box(Box<TT, DD> &&u, EnableIf<IsArray<TT>::value
&& __OctaSameOrLessCVQualified<typename Box<TT, DD>::pointer, && __OctaSameOrLessCvQualified<typename Box<TT, DD>::pointer,
pointer>::value pointer>::value
&& IsConvertible<DD, D>::value && IsConvertible<DD, D>::value
&& (!IsReference<D>::value || IsSame<D, DD>::value)> = __OctaNAT() && (!IsReference<D>::value || IsSame<D, DD>::value)> = __OctaNat()
): p_ptr(u.release()), p_del(forward<DD>(u.get_deleter())) {} ): p_ptr(u.release()), p_del(forward<DD>(u.get_deleter())) {}
Box &operator=(Box &&u) { Box &operator=(Box &&u) {
@ -370,7 +370,7 @@ namespace octa {
template<typename TT, typename DD> template<typename TT, typename DD>
EnableIf<IsArray<TT>::value EnableIf<IsArray<TT>::value
&& __OctaSameOrLessCVQualified<typename Box<TT, DD>::pointer, && __OctaSameOrLessCvQualified<typename Box<TT, DD>::pointer,
pointer>::value pointer>::value
&& IsAssignable<D &, DD &&>::value, && IsAssignable<D &, DD &&>::value,
Box & Box &
@ -405,7 +405,7 @@ namespace octa {
} }
template<typename U> EnableIf< template<typename U> EnableIf<
__OctaSameOrLessCVQualified<U, pointer>::value, void __OctaSameOrLessCvQualified<U, pointer>::value, void
> reset(U p) { > reset(U p) {
pointer tmp = p_ptr; pointer tmp = p_ptr;
p_ptr = p; p_ptr = p;

View File

@ -13,9 +13,9 @@
namespace octa { namespace octa {
/* forward declarations */ /* forward declarations */
template<typename> struct __OctaRemoveCV; template<typename> struct __OctaRemoveCv;
template<typename> struct __OctaAddLR; template<typename> struct __OctaAddLr;
template<typename> struct __OctaAddRR; template<typename> struct __OctaAddRr;
template<typename> struct __OctaAddConst; template<typename> struct __OctaAddConst;
template<typename> struct IsReference; template<typename> struct IsReference;
template<typename> struct __OctaRemoveReference; template<typename> struct __OctaRemoveReference;
@ -25,7 +25,7 @@ namespace octa {
template<typename...> struct __OctaCommonType; template<typename...> struct __OctaCommonType;
/* declval also defined here to avoid including utility.h */ /* declval also defined here to avoid including utility.h */
template<typename T> typename __OctaAddRR<T>::type __octa_declval(); template<typename T> typename __OctaAddRr<T>::type __octa_declval();
/* integral constant */ /* integral constant */
@ -51,7 +51,7 @@ namespace octa {
template< > struct __OctaIsVoid<void>: True {}; template< > struct __OctaIsVoid<void>: True {};
template<typename T> template<typename T>
struct IsVoid: __OctaIsVoid<typename __OctaRemoveCV<T>::type> {}; struct IsVoid: __OctaIsVoid<typename __OctaRemoveCv<T>::type> {};
/* is null pointer */ /* is null pointer */
@ -59,7 +59,7 @@ namespace octa {
template< > struct __OctaIsNullPointer<nullptr_t>: True {}; template< > struct __OctaIsNullPointer<nullptr_t>: True {};
template<typename T> struct IsNullPointer: __OctaIsNullPointer< template<typename T> struct IsNullPointer: __OctaIsNullPointer<
typename __OctaRemoveCV<T>::type typename __OctaRemoveCv<T>::type
> {}; > {};
/* is integer */ /* is integer */
@ -80,7 +80,7 @@ namespace octa {
template<> struct __OctaIsIntegral<ullong>: True {}; template<> struct __OctaIsIntegral<ullong>: True {};
template<typename T> template<typename T>
struct IsIntegral: __OctaIsIntegral<typename __OctaRemoveCV<T>::type> {}; struct IsIntegral: __OctaIsIntegral<typename __OctaRemoveCv<T>::type> {};
/* is floating point */ /* is floating point */
@ -91,7 +91,7 @@ namespace octa {
template<> struct __OctaIsFloatingPoint<ldouble>: True {}; template<> struct __OctaIsFloatingPoint<ldouble>: True {};
template<typename T> template<typename T>
struct IsFloatingPoint: __OctaIsFloatingPoint<typename __OctaRemoveCV<T>::type> {}; struct IsFloatingPoint: __OctaIsFloatingPoint<typename __OctaRemoveCv<T>::type> {};
/* is array */ /* is array */
@ -105,7 +105,7 @@ namespace octa {
template<typename T> struct __OctaIsPointer<T *>: True {}; template<typename T> struct __OctaIsPointer<T *>: True {};
template<typename T> template<typename T>
struct IsPointer: __OctaIsPointer<typename __OctaRemoveCV<T>::type> {}; struct IsPointer: __OctaIsPointer<typename __OctaRemoveCv<T>::type> {};
/* is lvalue reference */ /* is lvalue reference */
@ -179,7 +179,7 @@ namespace octa {
template<typename T> template<typename T>
struct IsMemberPointer: __OctaIsMemberPointer< struct IsMemberPointer: __OctaIsMemberPointer<
typename __OctaRemoveCV<T>::type typename __OctaRemoveCv<T>::type
> {}; > {};
/* is pointer to member object */ /* is pointer to member object */
@ -193,7 +193,7 @@ namespace octa {
> {}; > {};
template<typename T> struct IsMemberObjectPointer: template<typename T> struct IsMemberObjectPointer:
__OctaIsMemberObjectPointer<typename __OctaRemoveCV<T>::type> {}; __OctaIsMemberObjectPointer<typename __OctaRemoveCv<T>::type> {};
/* is pointer to member function */ /* is pointer to member function */
@ -206,7 +206,7 @@ namespace octa {
> {}; > {};
template<typename T> struct IsMemberFunctionPointer: template<typename T> struct IsMemberFunctionPointer:
__OctaIsMemberFunctionPointer<typename __OctaRemoveCV<T>::type> {}; __OctaIsMemberFunctionPointer<typename __OctaRemoveCv<T>::type> {};
/* is reference */ /* is reference */
@ -249,7 +249,7 @@ namespace octa {
/* is POD */ /* is POD */
template<typename T> struct IsPOD: IntegralConstant<bool, __is_pod(T)> {}; template<typename T> struct IsPod: IntegralConstant<bool, __is_pod(T)> {};
/* is polymorphic */ /* is polymorphic */
@ -399,13 +399,13 @@ namespace octa {
/* is copy constructible */ /* is copy constructible */
template<typename T> struct IsCopyConstructible: IsConstructible<T, template<typename T> struct IsCopyConstructible: IsConstructible<T,
typename __OctaAddLR<typename __OctaAddConst<T>::type>::type typename __OctaAddLr<typename __OctaAddConst<T>::type>::type
> {}; > {};
/* is move constructible */ /* is move constructible */
template<typename T> struct IsMoveConstructible: IsConstructible<T, template<typename T> struct IsMoveConstructible: IsConstructible<T,
typename __OctaAddRR<T>::type typename __OctaAddRr<T>::type
> {}; > {};
/* is assignable */ /* is assignable */
@ -430,15 +430,15 @@ namespace octa {
/* is copy assignable */ /* is copy assignable */
template<typename T> struct IsCopyAssignable: IsAssignable< template<typename T> struct IsCopyAssignable: IsAssignable<
typename __OctaAddLR<T>::type, typename __OctaAddLr<T>::type,
typename __OctaAddLR<typename __OctaAddConst<T>::type>::type typename __OctaAddLr<typename __OctaAddConst<T>::type>::type
> {}; > {};
/* is move assignable */ /* is move assignable */
template<typename T> struct IsMoveAssignable: IsAssignable< template<typename T> struct IsMoveAssignable: IsAssignable<
typename __OctaAddLR<T>::type, typename __OctaAddLr<T>::type,
const typename __OctaAddRR<T>::type const typename __OctaAddRr<T>::type
> {}; > {};
/* is destructible */ /* is destructible */
@ -512,14 +512,14 @@ namespace octa {
template<typename T> template<typename T>
struct IsTriviallyCopyConstructible: IsTriviallyConstructible<T, struct IsTriviallyCopyConstructible: IsTriviallyConstructible<T,
typename __OctaAddLR<const T>::type typename __OctaAddLr<const T>::type
> {}; > {};
/* is trivially move constructible */ /* is trivially move constructible */
template<typename T> template<typename T>
struct IsTriviallyMoveConstructible: IsTriviallyConstructible<T, struct IsTriviallyMoveConstructible: IsTriviallyConstructible<T,
typename __OctaAddRR<T>::type typename __OctaAddRr<T>::type
> {}; > {};
/* is trivially assignable */ /* is trivially assignable */
@ -551,14 +551,14 @@ namespace octa {
template<typename T> template<typename T>
struct IsTriviallyCopyAssignable: IsTriviallyAssignable<T, struct IsTriviallyCopyAssignable: IsTriviallyAssignable<T,
typename __OctaAddLR<const T>::type typename __OctaAddLr<const T>::type
> {}; > {};
/* is trivially move assignable */ /* is trivially move assignable */
template<typename T> template<typename T>
struct IsTriviallyMoveAssignable: IsTriviallyAssignable<T, struct IsTriviallyMoveAssignable: IsTriviallyAssignable<T,
typename __OctaAddRR<T>::type typename __OctaAddRr<T>::type
> {}; > {};
/* is trivially destructible */ /* is trivially destructible */
@ -602,14 +602,14 @@ namespace octa {
template<typename T> template<typename T>
struct IsNothrowCopyConstructible: IsNothrowConstructible<T, struct IsNothrowCopyConstructible: IsNothrowConstructible<T,
typename __OctaAddLR<const T>::type typename __OctaAddLr<const T>::type
> {}; > {};
/* is nothrow move constructible */ /* is nothrow move constructible */
template<typename T> template<typename T>
struct IsNothrowMoveConstructible: IsNothrowConstructible<T, struct IsNothrowMoveConstructible: IsNothrowConstructible<T,
typename __OctaAddRR<T>::type typename __OctaAddRr<T>::type
> {}; > {};
/* is nothrow assignable */ /* is nothrow assignable */
@ -641,14 +641,14 @@ namespace octa {
template<typename T> template<typename T>
struct IsNothrowCopyAssignable: IsNothrowAssignable<T, struct IsNothrowCopyAssignable: IsNothrowAssignable<T,
typename __OctaAddLR<const T>::type typename __OctaAddLr<const T>::type
> {}; > {};
/* is nothrow move assignable */ /* is nothrow move assignable */
template<typename T> template<typename T>
struct IsNothrowMoveAssignable: IsNothrowAssignable<T, struct IsNothrowMoveAssignable: IsNothrowAssignable<T,
typename __OctaAddRR<T>::type typename __OctaAddRr<T>::type
> {}; > {};
/* is nothrow destructible */ /* is nothrow destructible */
@ -747,7 +747,7 @@ namespace octa {
struct __OctaRemoveVolatile<volatile T> { typedef T type; }; struct __OctaRemoveVolatile<volatile T> { typedef T type; };
template<typename T> template<typename T>
struct __OctaRemoveCV { struct __OctaRemoveCv {
typedef typename __OctaRemoveVolatile< typedef typename __OctaRemoveVolatile<
typename __OctaRemoveConst<T>::type typename __OctaRemoveConst<T>::type
>::type type; >::type type;
@ -758,7 +758,7 @@ namespace octa {
template<typename T> template<typename T>
using RemoveVolatile = typename __OctaRemoveVolatile<T>::type; using RemoveVolatile = typename __OctaRemoveVolatile<T>::type;
template<typename T> template<typename T>
using RemoveCV = typename __OctaRemoveCV<T>::type; using RemoveCv = typename __OctaRemoveCv<T>::type;
/* add const, volatile, cv */ /* add const, volatile, cv */
@ -787,7 +787,7 @@ namespace octa {
}; };
template<typename T> template<typename T>
struct __OctaAddCV { struct __OctaAddCv {
typedef typename __OctaAddConst< typedef typename __OctaAddConst<
typename __OctaAddVolatile<T>::type typename __OctaAddVolatile<T>::type
>::type type; >::type type;
@ -798,7 +798,7 @@ namespace octa {
template<typename T> template<typename T>
using AddVolatile = typename __OctaAddVolatile<T>::type; using AddVolatile = typename __OctaAddVolatile<T>::type;
template<typename T> template<typename T>
using AddCV = typename __OctaAddCV<T>::type; using AddCv = typename __OctaAddCv<T>::type;
/* remove reference */ /* remove reference */
@ -839,45 +839,45 @@ namespace octa {
/* add lvalue reference */ /* add lvalue reference */
template<typename T> struct __OctaAddLR { typedef T &type; }; template<typename T> struct __OctaAddLr { typedef T &type; };
template<typename T> struct __OctaAddLR<T &> { typedef T &type; }; template<typename T> struct __OctaAddLr<T &> { typedef T &type; };
template<typename T> struct __OctaAddLR<T &&> { typedef T &type; }; template<typename T> struct __OctaAddLr<T &&> { typedef T &type; };
template<> struct __OctaAddLR<void> { template<> struct __OctaAddLr<void> {
typedef void type; typedef void type;
}; };
template<> struct __OctaAddLR<const void> { template<> struct __OctaAddLr<const void> {
typedef const void type; typedef const void type;
}; };
template<> struct __OctaAddLR<volatile void> { template<> struct __OctaAddLr<volatile void> {
typedef volatile void type; typedef volatile void type;
}; };
template<> struct __OctaAddLR<const volatile void> { template<> struct __OctaAddLr<const volatile void> {
typedef const volatile void type; typedef const volatile void type;
}; };
template<typename T> template<typename T>
using AddLvalueReference = typename __OctaAddLR<T>::type; using AddLvalueReference = typename __OctaAddLr<T>::type;
/* add rvalue reference */ /* add rvalue reference */
template<typename T> struct __OctaAddRR { typedef T &&type; }; template<typename T> struct __OctaAddRr { typedef T &&type; };
template<typename T> struct __OctaAddRR<T &> { typedef T &&type; }; template<typename T> struct __OctaAddRr<T &> { typedef T &&type; };
template<typename T> struct __OctaAddRR<T &&> { typedef T &&type; }; template<typename T> struct __OctaAddRr<T &&> { typedef T &&type; };
template<> struct __OctaAddRR<void> { template<> struct __OctaAddRr<void> {
typedef void type; typedef void type;
}; };
template<> struct __OctaAddRR<const void> { template<> struct __OctaAddRr<const void> {
typedef const void type; typedef const void type;
}; };
template<> struct __OctaAddRR<volatile void> { template<> struct __OctaAddRr<volatile void> {
typedef volatile void type; typedef volatile void type;
}; };
template<> struct __OctaAddRR<const volatile void> { template<> struct __OctaAddRr<const volatile void> {
typedef const volatile void type; typedef const volatile void type;
}; };
template<typename T> template<typename T>
using AddRvalueReference = typename __OctaAddRR<T>::type; using AddRvalueReference = typename __OctaAddRr<T>::type;
/* remove extent */ /* remove extent */
@ -912,78 +912,78 @@ namespace octa {
* shamelessly copied from graphitemaster @ neothyne * shamelessly copied from graphitemaster @ neothyne
*/ */
template<typename T, typename U> struct __OctaTL { template<typename T, typename U> struct __OctaTl {
typedef T first; typedef T first;
typedef U rest; typedef U rest;
}; };
/* not a type */ /* not a type */
struct __OctaNAT { struct __OctaNat {
__OctaNAT() = delete; __OctaNat() = delete;
__OctaNAT(const __OctaNAT &) = delete; __OctaNat(const __OctaNat &) = delete;
__OctaNAT &operator=(const __OctaNAT &) = delete; __OctaNat &operator=(const __OctaNat &) = delete;
~__OctaNAT() = delete; ~__OctaNat() = delete;
}; };
typedef __OctaTL<schar, typedef __OctaTl<schar,
__OctaTL<short, __OctaTl<short,
__OctaTL<int, __OctaTl<int,
__OctaTL<long, __OctaTl<long,
__OctaTL<llong, __OctaNAT>>>>> stypes; __OctaTl<llong, __OctaNat>>>>> stypes;
typedef __OctaTL<uchar, typedef __OctaTl<uchar,
__OctaTL<ushort, __OctaTl<ushort,
__OctaTL<uint, __OctaTl<uint,
__OctaTL<ulong, __OctaTl<ulong,
__OctaTL<ullong, __OctaNAT>>>>> utypes; __OctaTl<ullong, __OctaNat>>>>> utypes;
template<typename T, size_t N, bool = (N <= sizeof(typename T::first))> template<typename T, size_t N, bool = (N <= sizeof(typename T::first))>
struct __OctaTypeFindFirst; struct __OctaTypeFindFirst;
template<typename T, typename U, size_t N> template<typename T, typename U, size_t N>
struct __OctaTypeFindFirst<__OctaTL<T, U>, N, true> { struct __OctaTypeFindFirst<__OctaTl<T, U>, N, true> {
typedef T type; typedef T type;
}; };
template<typename T, typename U, size_t N> template<typename T, typename U, size_t N>
struct __OctaTypeFindFirst<__OctaTL<T, U>, N, false> { struct __OctaTypeFindFirst<__OctaTl<T, U>, N, false> {
typedef typename __OctaTypeFindFirst<U, N>::type type; typedef typename __OctaTypeFindFirst<U, N>::type type;
}; };
template<typename T, typename U, template<typename T, typename U,
bool = IsConst<typename __OctaRemoveReference<T>::type>::value, bool = IsConst<typename __OctaRemoveReference<T>::type>::value,
bool = IsVolatile<typename __OctaRemoveReference<T>::type>::value bool = IsVolatile<typename __OctaRemoveReference<T>::type>::value
> struct __OctaApplyCV { > struct __OctaApplyCv {
typedef U type; typedef U type;
}; };
template<typename T, typename U> template<typename T, typename U>
struct __OctaApplyCV<T, U, true, false> { /* const */ struct __OctaApplyCv<T, U, true, false> { /* const */
typedef const U type; typedef const U type;
}; };
template<typename T, typename U> template<typename T, typename U>
struct __OctaApplyCV<T, U, false, true> { /* volatile */ struct __OctaApplyCv<T, U, false, true> { /* volatile */
typedef volatile U type; typedef volatile U type;
}; };
template<typename T, typename U> template<typename T, typename U>
struct __OctaApplyCV<T, U, true, true> { /* const volatile */ struct __OctaApplyCv<T, U, true, true> { /* const volatile */
typedef const volatile U type; typedef const volatile U type;
}; };
template<typename T, typename U> template<typename T, typename U>
struct __OctaApplyCV<T &, U, true, false> { /* const */ struct __OctaApplyCv<T &, U, true, false> { /* const */
typedef const U &type; typedef const U &type;
}; };
template<typename T, typename U> template<typename T, typename U>
struct __OctaApplyCV<T &, U, false, true> { /* volatile */ struct __OctaApplyCv<T &, U, false, true> { /* volatile */
typedef volatile U &type; typedef volatile U &type;
}; };
template<typename T, typename U> template<typename T, typename U>
struct __OctaApplyCV<T &, U, true, true> { /* const volatile */ struct __OctaApplyCv<T &, U, true, true> { /* const volatile */
typedef const volatile U &type; typedef const volatile U &type;
}; };
@ -1028,17 +1028,17 @@ namespace octa {
template<> struct __OctaMakeUnsigned<ullong, true> { typedef ullong type; }; template<> struct __OctaMakeUnsigned<ullong, true> { typedef ullong type; };
template<typename T> struct __OctaMakeSignedBase { template<typename T> struct __OctaMakeSignedBase {
typedef typename __OctaApplyCV<T, typedef typename __OctaApplyCv<T,
typename __OctaMakeSigned< typename __OctaMakeSigned<
typename __OctaRemoveCV<T>::type typename __OctaRemoveCv<T>::type
>::type >::type
>::type type; >::type type;
}; };
template<typename T> struct __OctaMakeUnsignedBase { template<typename T> struct __OctaMakeUnsignedBase {
typedef typename __OctaApplyCV<T, typedef typename __OctaApplyCv<T,
typename __OctaMakeUnsigned< typename __OctaMakeUnsigned<
typename __OctaRemoveCV<T>::type typename __OctaRemoveCv<T>::type
>::type >::type
>::type type; >::type type;
}; };
@ -1127,7 +1127,7 @@ namespace octa {
typename __OctaRemoveExtent<U>::type *, typename __OctaRemoveExtent<U>::type *,
typename __OctaConditional<IsFunction<U>::value, typename __OctaConditional<IsFunction<U>::value,
typename __OctaAddPointer<U>::type, typename __OctaAddPointer<U>::type,
typename __OctaRemoveCV<U>::type typename __OctaRemoveCv<U>::type
>::type >::type
>::type type; >::type type;
}; };

View File

@ -76,7 +76,7 @@ namespace octa {
void clear() { void clear() {
if (p_cap > 0) { if (p_cap > 0) {
if (!octa::IsPOD<T>()) { if (!octa::IsPod<T>()) {
T *cur = p_buf, *last = p_buf + p_len; T *cur = p_buf, *last = p_buf + p_len;
while (cur != last) (*cur++).~T(); while (cur != last) (*cur++).~T();
} }
@ -90,7 +90,7 @@ namespace octa {
if (this == &v) return *this; if (this == &v) return *this;
if (p_cap >= v.p_cap) { if (p_cap >= v.p_cap) {
if (!octa::IsPOD<T>()) { if (!octa::IsPod<T>()) {
T *cur = p_buf, *last = p_buf + p_len; T *cur = p_buf, *last = p_buf + p_len;
while (cur != last) (*cur++).~T(); while (cur != last) (*cur++).~T();
} }
@ -102,7 +102,7 @@ namespace octa {
p_buf = (T *)new uchar[p_cap * sizeof(T)]; p_buf = (T *)new uchar[p_cap * sizeof(T)];
} }
if (octa::IsPOD<T>()) { if (octa::IsPod<T>()) {
memcpy(p_buf, v.p_buf, p_len * sizeof(T)); memcpy(p_buf, v.p_buf, p_len * sizeof(T));
} else { } else {
T *cur = p_buf, *last = p_buf + p_len; T *cur = p_buf, *last = p_buf + p_len;
@ -127,7 +127,7 @@ namespace octa {
size_t len = p_len; size_t len = p_len;
reserve(n); reserve(n);
p_len = n; p_len = n;
if (octa::IsPOD<T>()) { if (octa::IsPod<T>()) {
for (size_t i = len; i < p_len; ++i) { for (size_t i = len; i < p_len; ++i) {
p_buf[i] = T(v); p_buf[i] = T(v);
} }
@ -152,7 +152,7 @@ namespace octa {
} }
T *tmp = (T *)new uchar[p_cap * sizeof(T)]; T *tmp = (T *)new uchar[p_cap * sizeof(T)];
if (oc > 0) { if (oc > 0) {
if (octa::IsPOD<T>()) { if (octa::IsPod<T>()) {
memcpy(tmp, p_buf, p_len * sizeof(T)); memcpy(tmp, p_buf, p_len * sizeof(T));
} else { } else {
T *cur = p_buf, *tcur = tmp, *last = tmp + p_len; T *cur = p_buf, *tcur = tmp, *last = tmp + p_len;
@ -193,7 +193,7 @@ namespace octa {
} }
void pop() { void pop() {
if (!octa::IsPOD<T>()) { if (!octa::IsPod<T>()) {
p_buf[--p_len].~T(); p_buf[--p_len].~T();
} else { } else {
--p_len; --p_len;