diff --git a/octa/functional.h b/octa/functional.h index d27a6be..6919c89 100644 --- a/octa/functional.h +++ b/octa/functional.h @@ -259,7 +259,7 @@ namespace octa { struct __OctaFunctionManager; - struct __OctaFMStorage { + struct __OctaFmStorage { __OctaFunctorData data; const __OctaFunctionManager *manager; }; @@ -277,15 +277,15 @@ namespace octa { }; } - void (* const call_move_and_destroy)(__OctaFMStorage &lhs, - __OctaFMStorage &&rhs); - void (* const call_copy)(__OctaFMStorage &lhs, - const __OctaFMStorage &rhs); - void (* const call_destroy)(__OctaFMStorage &s); + void (* const call_move_and_destroy)(__OctaFmStorage &lhs, + __OctaFmStorage &&rhs); + void (* const call_copy)(__OctaFmStorage &lhs, + const __OctaFmStorage &rhs); + void (* const call_destroy)(__OctaFmStorage &s); template - static void t_call_move_and_destroy(__OctaFMStorage &lhs, - __OctaFMStorage &&rhs) { + static void t_call_move_and_destroy(__OctaFmStorage &lhs, + __OctaFmStorage &&rhs) { typedef __OctaFunctorDataManager spec; spec::move_f(lhs.data, move(rhs.data)); spec::destroy_f(rhs.data); @@ -293,15 +293,15 @@ namespace octa { } template - static void t_call_copy(__OctaFMStorage &lhs, - const __OctaFMStorage &rhs) { + static void t_call_copy(__OctaFmStorage &lhs, + const __OctaFmStorage &rhs) { typedef __OctaFunctorDataManager spec; lhs.manager = &__octa_get_default_fm(); spec::store_f(lhs.data, spec::get_ref(rhs.data)); } template - static void t_call_destroy(__OctaFMStorage &s) { + static void t_call_destroy(__OctaFmStorage &s) { typedef __OctaFunctorDataManager spec; spec::destroy_f(s.data); } @@ -381,7 +381,7 @@ namespace octa { } void swap(Function &f) { - __OctaFMStorage tmp; + __OctaFmStorage tmp; 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)); tmp.manager->call_move_and_destroy(p_stor, move(tmp)); @@ -391,7 +391,7 @@ namespace octa { operator bool() const { return p_call != nullptr; } private: - __OctaFMStorage p_stor; + __OctaFmStorage p_stor; R (*p_call)(const __OctaFunctorData &, A...); template diff --git a/octa/memory.h b/octa/memory.h index 31b011d..8deca1a 100644 --- a/octa/memory.h +++ b/octa/memory.h @@ -105,11 +105,11 @@ namespace octa { using rebind = typename __OctaPtrTraitsRebind::type; private: - struct __OctaNAT {}; + struct __OctaNat {}; public: static T pointer_to(Conditional::value, - __OctaNAT, element_type + __OctaNat, element_type > &r) { return T::pointer_to(r); } @@ -125,11 +125,11 @@ namespace octa { template using rebind = U *; private: - struct __OctaNAT {}; + struct __OctaNat {}; public: static T pointer_to(Conditional::value, - __OctaNAT, element_type + __OctaNat, element_type > &r) { return octa::address_of(r); } @@ -191,7 +191,7 @@ namespace octa { typedef typename __OctaPtrType::type pointer; private: - struct __OctaNAT { int x; }; + struct __OctaNat { int x; }; typedef RemoveReference &D_ref; typedef const RemoveReference &D_cref; @@ -227,7 +227,7 @@ namespace octa { && IsConvertible::pointer, pointer>::value && IsConvertible::value && (!IsReference::value || IsSame::value) - > = __OctaNAT()): p_ptr(u.release()), + > = __OctaNat()): p_ptr(u.release()), p_del(forward
(u.get_deleter())) {} Box &operator=(Box &&u) { @@ -288,19 +288,19 @@ namespace octa { }; template::element_type>, - RemoveCV::element_type> - >::value> struct __OctaSameOrLessCVQualifiedBase: IsConvertible {}; + RemoveCv::element_type>, + RemoveCv::element_type> + >::value> struct __OctaSameOrLessCvQualifiedBase: IsConvertible {}; template - struct __OctaSameOrLessCVQualifiedBase: False {}; + struct __OctaSameOrLessCvQualifiedBase: False {}; template::value || IsSame::value || __OctaHasElementType::value - > struct __OctaSameOrLessCVQualified: __OctaSameOrLessCVQualifiedBase {}; + > struct __OctaSameOrLessCvQualified: __OctaSameOrLessCvQualifiedBase {}; template - struct __OctaSameOrLessCVQualified: False {}; + struct __OctaSameOrLessCvQualified: False {}; template struct Box { @@ -309,7 +309,7 @@ namespace octa { typedef typename __OctaPtrType::type pointer; private: - struct __OctaNAT { int x; }; + struct __OctaNat { int x; }; typedef RemoveReference &D_ref; typedef const RemoveReference &D_cref; @@ -325,24 +325,24 @@ namespace octa { } template explicit Box(U p, EnableIf< - __OctaSameOrLessCVQualified::value, __OctaNAT - > = __OctaNAT()): p_ptr(p), p_del() { + __OctaSameOrLessCvQualified::value, __OctaNat + > = __OctaNat()): p_ptr(p), p_del() { static_assert(!IsPointer::value, "Box constructed with null fptr deleter"); } template Box(U p, Conditional::value, D, AddLvalueReference - > d, EnableIf<__OctaSameOrLessCVQualified::value, __OctaNAT - > = __OctaNAT()): p_ptr(p), p_del(d) {} + > d, EnableIf<__OctaSameOrLessCvQualified::value, __OctaNat + > = __OctaNat()): p_ptr(p), p_del(d) {} Box(nullptr_t, Conditional::value, D, AddLvalueReference > d): p_ptr(), p_del(d) {} template Box(U p, RemoveReference &&d, EnableIf< - __OctaSameOrLessCVQualified::value, __OctaNAT - > = __OctaNAT()): p_ptr(p), p_del(move(d)) { + __OctaSameOrLessCvQualified::value, __OctaNat + > = __OctaNat()): p_ptr(p), p_del(move(d)) { static_assert(!IsReference::value, "rvalue deleter cannot be a ref"); } @@ -356,10 +356,10 @@ namespace octa { template Box(Box &&u, EnableIf::value - && __OctaSameOrLessCVQualified::pointer, + && __OctaSameOrLessCvQualified::pointer, pointer>::value && IsConvertible::value - && (!IsReference::value || IsSame::value)> = __OctaNAT() + && (!IsReference::value || IsSame::value)> = __OctaNat() ): p_ptr(u.release()), p_del(forward
(u.get_deleter())) {} Box &operator=(Box &&u) { @@ -370,7 +370,7 @@ namespace octa { template EnableIf::value - && __OctaSameOrLessCVQualified::pointer, + && __OctaSameOrLessCvQualified::pointer, pointer>::value && IsAssignable::value, Box & @@ -405,7 +405,7 @@ namespace octa { } template EnableIf< - __OctaSameOrLessCVQualified::value, void + __OctaSameOrLessCvQualified::value, void > reset(U p) { pointer tmp = p_ptr; p_ptr = p; diff --git a/octa/type_traits.h b/octa/type_traits.h index 908429d..cb7f786 100644 --- a/octa/type_traits.h +++ b/octa/type_traits.h @@ -13,9 +13,9 @@ namespace octa { /* forward declarations */ - template struct __OctaRemoveCV; - template struct __OctaAddLR; - template struct __OctaAddRR; + template struct __OctaRemoveCv; + template struct __OctaAddLr; + template struct __OctaAddRr; template struct __OctaAddConst; template struct IsReference; template struct __OctaRemoveReference; @@ -25,7 +25,7 @@ namespace octa { template struct __OctaCommonType; /* declval also defined here to avoid including utility.h */ - template typename __OctaAddRR::type __octa_declval(); + template typename __OctaAddRr::type __octa_declval(); /* integral constant */ @@ -51,7 +51,7 @@ namespace octa { template< > struct __OctaIsVoid: True {}; template - struct IsVoid: __OctaIsVoid::type> {}; + struct IsVoid: __OctaIsVoid::type> {}; /* is null pointer */ @@ -59,7 +59,7 @@ namespace octa { template< > struct __OctaIsNullPointer: True {}; template struct IsNullPointer: __OctaIsNullPointer< - typename __OctaRemoveCV::type + typename __OctaRemoveCv::type > {}; /* is integer */ @@ -80,7 +80,7 @@ namespace octa { template<> struct __OctaIsIntegral: True {}; template - struct IsIntegral: __OctaIsIntegral::type> {}; + struct IsIntegral: __OctaIsIntegral::type> {}; /* is floating point */ @@ -91,7 +91,7 @@ namespace octa { template<> struct __OctaIsFloatingPoint: True {}; template - struct IsFloatingPoint: __OctaIsFloatingPoint::type> {}; + struct IsFloatingPoint: __OctaIsFloatingPoint::type> {}; /* is array */ @@ -105,7 +105,7 @@ namespace octa { template struct __OctaIsPointer: True {}; template - struct IsPointer: __OctaIsPointer::type> {}; + struct IsPointer: __OctaIsPointer::type> {}; /* is lvalue reference */ @@ -179,7 +179,7 @@ namespace octa { template struct IsMemberPointer: __OctaIsMemberPointer< - typename __OctaRemoveCV::type + typename __OctaRemoveCv::type > {}; /* is pointer to member object */ @@ -193,7 +193,7 @@ namespace octa { > {}; template struct IsMemberObjectPointer: - __OctaIsMemberObjectPointer::type> {}; + __OctaIsMemberObjectPointer::type> {}; /* is pointer to member function */ @@ -206,7 +206,7 @@ namespace octa { > {}; template struct IsMemberFunctionPointer: - __OctaIsMemberFunctionPointer::type> {}; + __OctaIsMemberFunctionPointer::type> {}; /* is reference */ @@ -249,7 +249,7 @@ namespace octa { /* is POD */ - template struct IsPOD: IntegralConstant {}; + template struct IsPod: IntegralConstant {}; /* is polymorphic */ @@ -399,13 +399,13 @@ namespace octa { /* is copy constructible */ template struct IsCopyConstructible: IsConstructible::type>::type + typename __OctaAddLr::type>::type > {}; /* is move constructible */ template struct IsMoveConstructible: IsConstructible::type + typename __OctaAddRr::type > {}; /* is assignable */ @@ -430,15 +430,15 @@ namespace octa { /* is copy assignable */ template struct IsCopyAssignable: IsAssignable< - typename __OctaAddLR::type, - typename __OctaAddLR::type>::type + typename __OctaAddLr::type, + typename __OctaAddLr::type>::type > {}; /* is move assignable */ template struct IsMoveAssignable: IsAssignable< - typename __OctaAddLR::type, - const typename __OctaAddRR::type + typename __OctaAddLr::type, + const typename __OctaAddRr::type > {}; /* is destructible */ @@ -512,14 +512,14 @@ namespace octa { template struct IsTriviallyCopyConstructible: IsTriviallyConstructible::type + typename __OctaAddLr::type > {}; /* is trivially move constructible */ template struct IsTriviallyMoveConstructible: IsTriviallyConstructible::type + typename __OctaAddRr::type > {}; /* is trivially assignable */ @@ -551,14 +551,14 @@ namespace octa { template struct IsTriviallyCopyAssignable: IsTriviallyAssignable::type + typename __OctaAddLr::type > {}; /* is trivially move assignable */ template struct IsTriviallyMoveAssignable: IsTriviallyAssignable::type + typename __OctaAddRr::type > {}; /* is trivially destructible */ @@ -602,14 +602,14 @@ namespace octa { template struct IsNothrowCopyConstructible: IsNothrowConstructible::type + typename __OctaAddLr::type > {}; /* is nothrow move constructible */ template struct IsNothrowMoveConstructible: IsNothrowConstructible::type + typename __OctaAddRr::type > {}; /* is nothrow assignable */ @@ -641,14 +641,14 @@ namespace octa { template struct IsNothrowCopyAssignable: IsNothrowAssignable::type + typename __OctaAddLr::type > {}; /* is nothrow move assignable */ template struct IsNothrowMoveAssignable: IsNothrowAssignable::type + typename __OctaAddRr::type > {}; /* is nothrow destructible */ @@ -747,7 +747,7 @@ namespace octa { struct __OctaRemoveVolatile { typedef T type; }; template - struct __OctaRemoveCV { + struct __OctaRemoveCv { typedef typename __OctaRemoveVolatile< typename __OctaRemoveConst::type >::type type; @@ -758,7 +758,7 @@ namespace octa { template using RemoveVolatile = typename __OctaRemoveVolatile::type; template - using RemoveCV = typename __OctaRemoveCV::type; + using RemoveCv = typename __OctaRemoveCv::type; /* add const, volatile, cv */ @@ -787,7 +787,7 @@ namespace octa { }; template - struct __OctaAddCV { + struct __OctaAddCv { typedef typename __OctaAddConst< typename __OctaAddVolatile::type >::type type; @@ -798,7 +798,7 @@ namespace octa { template using AddVolatile = typename __OctaAddVolatile::type; template - using AddCV = typename __OctaAddCV::type; + using AddCv = typename __OctaAddCv::type; /* remove reference */ @@ -839,45 +839,45 @@ namespace octa { /* add lvalue reference */ - template struct __OctaAddLR { typedef T &type; }; - template struct __OctaAddLR { typedef T &type; }; - template struct __OctaAddLR { typedef T &type; }; - template<> struct __OctaAddLR { + template struct __OctaAddLr { typedef T &type; }; + template struct __OctaAddLr { typedef T &type; }; + template struct __OctaAddLr { typedef T &type; }; + template<> struct __OctaAddLr { typedef void type; }; - template<> struct __OctaAddLR { + template<> struct __OctaAddLr { typedef const void type; }; - template<> struct __OctaAddLR { + template<> struct __OctaAddLr { typedef volatile void type; }; - template<> struct __OctaAddLR { + template<> struct __OctaAddLr { typedef const volatile void type; }; template - using AddLvalueReference = typename __OctaAddLR::type; + using AddLvalueReference = typename __OctaAddLr::type; /* add rvalue reference */ - template struct __OctaAddRR { typedef T &&type; }; - template struct __OctaAddRR { typedef T &&type; }; - template struct __OctaAddRR { typedef T &&type; }; - template<> struct __OctaAddRR { + template struct __OctaAddRr { typedef T &&type; }; + template struct __OctaAddRr { typedef T &&type; }; + template struct __OctaAddRr { typedef T &&type; }; + template<> struct __OctaAddRr { typedef void type; }; - template<> struct __OctaAddRR { + template<> struct __OctaAddRr { typedef const void type; }; - template<> struct __OctaAddRR { + template<> struct __OctaAddRr { typedef volatile void type; }; - template<> struct __OctaAddRR { + template<> struct __OctaAddRr { typedef const volatile void type; }; template - using AddRvalueReference = typename __OctaAddRR::type; + using AddRvalueReference = typename __OctaAddRr::type; /* remove extent */ @@ -912,78 +912,78 @@ namespace octa { * shamelessly copied from graphitemaster @ neothyne */ - template struct __OctaTL { + template struct __OctaTl { typedef T first; typedef U rest; }; /* not a type */ - struct __OctaNAT { - __OctaNAT() = delete; - __OctaNAT(const __OctaNAT &) = delete; - __OctaNAT &operator=(const __OctaNAT &) = delete; - ~__OctaNAT() = delete; + struct __OctaNat { + __OctaNat() = delete; + __OctaNat(const __OctaNat &) = delete; + __OctaNat &operator=(const __OctaNat &) = delete; + ~__OctaNat() = delete; }; - typedef __OctaTL>>>> stypes; + typedef __OctaTl>>>> stypes; - typedef __OctaTL>>>> utypes; + typedef __OctaTl>>>> utypes; template struct __OctaTypeFindFirst; template - struct __OctaTypeFindFirst<__OctaTL, N, true> { + struct __OctaTypeFindFirst<__OctaTl, N, true> { typedef T type; }; template - struct __OctaTypeFindFirst<__OctaTL, N, false> { + struct __OctaTypeFindFirst<__OctaTl, N, false> { typedef typename __OctaTypeFindFirst::type type; }; template::type>::value, bool = IsVolatile::type>::value - > struct __OctaApplyCV { + > struct __OctaApplyCv { typedef U type; }; template - struct __OctaApplyCV { /* const */ + struct __OctaApplyCv { /* const */ typedef const U type; }; template - struct __OctaApplyCV { /* volatile */ + struct __OctaApplyCv { /* volatile */ typedef volatile U type; }; template - struct __OctaApplyCV { /* const volatile */ + struct __OctaApplyCv { /* const volatile */ typedef const volatile U type; }; template - struct __OctaApplyCV { /* const */ + struct __OctaApplyCv { /* const */ typedef const U &type; }; template - struct __OctaApplyCV { /* volatile */ + struct __OctaApplyCv { /* volatile */ typedef volatile U &type; }; template - struct __OctaApplyCV { /* const volatile */ + struct __OctaApplyCv { /* const volatile */ typedef const volatile U &type; }; @@ -1028,17 +1028,17 @@ namespace octa { template<> struct __OctaMakeUnsigned { typedef ullong type; }; template struct __OctaMakeSignedBase { - typedef typename __OctaApplyCV::type + typename __OctaRemoveCv::type >::type >::type type; }; template struct __OctaMakeUnsignedBase { - typedef typename __OctaApplyCV::type + typename __OctaRemoveCv::type >::type >::type type; }; @@ -1127,7 +1127,7 @@ namespace octa { typename __OctaRemoveExtent::type *, typename __OctaConditional::value, typename __OctaAddPointer::type, - typename __OctaRemoveCV::type + typename __OctaRemoveCv::type >::type >::type type; }; diff --git a/octa/vector.h b/octa/vector.h index 9381e5a..0e27504 100644 --- a/octa/vector.h +++ b/octa/vector.h @@ -76,7 +76,7 @@ namespace octa { void clear() { if (p_cap > 0) { - if (!octa::IsPOD()) { + if (!octa::IsPod()) { T *cur = p_buf, *last = p_buf + p_len; while (cur != last) (*cur++).~T(); } @@ -90,7 +90,7 @@ namespace octa { if (this == &v) return *this; if (p_cap >= v.p_cap) { - if (!octa::IsPOD()) { + if (!octa::IsPod()) { T *cur = p_buf, *last = p_buf + p_len; while (cur != last) (*cur++).~T(); } @@ -102,7 +102,7 @@ namespace octa { p_buf = (T *)new uchar[p_cap * sizeof(T)]; } - if (octa::IsPOD()) { + if (octa::IsPod()) { memcpy(p_buf, v.p_buf, p_len * sizeof(T)); } else { T *cur = p_buf, *last = p_buf + p_len; @@ -127,7 +127,7 @@ namespace octa { size_t len = p_len; reserve(n); p_len = n; - if (octa::IsPOD()) { + if (octa::IsPod()) { for (size_t i = len; i < p_len; ++i) { p_buf[i] = T(v); } @@ -152,7 +152,7 @@ namespace octa { } T *tmp = (T *)new uchar[p_cap * sizeof(T)]; if (oc > 0) { - if (octa::IsPOD()) { + if (octa::IsPod()) { memcpy(tmp, p_buf, p_len * sizeof(T)); } else { T *cur = p_buf, *tcur = tmp, *last = tmp + p_len; @@ -193,7 +193,7 @@ namespace octa { } void pop() { - if (!octa::IsPOD()) { + if (!octa::IsPod()) { p_buf[--p_len].~T(); } else { --p_len;