basedOpinionated utility library |
git clone git://git.dimitrijedobrota.com/based.git |
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING |
commit | 361e63c3976c33718919e30ecce827bb6d18d14e |
parent | dd83f467be9aa956477d4a0f6f71e96221701b15 |
author | Dimitrije Dobrota < mail@dimitrijedobrota.com > |
date | Fri, 20 Jun 2025 12:29:03 +0200 |
Put all type traits in trait namespace
57 files changed, 471 insertions(+), 424 deletions(-)
diff --git a/ include/based/algorithm/clamp.hpp b/ include/based/algorithm/clamp.hpp
@@ -5,7 +5,7 @@
#include "based/concept/is/regular.hpp"
#include "based/concept/is/same.hpp"
#include "based/concept/procedure/procedure.hpp"
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_reference.hpp"
#include "based/utility/forward.hpp"
namespace based
@@ -36,7 +36,7 @@
constexpr decltype(auto) clamp(T&& value, U&& low, V&& high)
based::forward<T>(value),
based::forward<U>(low),
based::forward<V>(high),
[](const RemoveReferenceT<T>& llhs, const RemoveReferenceT<U>& lrhs)
[](const trait::RemoveReference<T>& llhs, const trait::RemoveReference<U>& lrhs)
{
return llhs < lrhs;
}
diff --git a/ include/based/algorithm/max.hpp b/ include/based/algorithm/max.hpp
@@ -3,7 +3,7 @@
#include "based/concept/is/regular.hpp"
#include "based/concept/is/same.hpp"
#include "based/concept/procedure/procedure.hpp"
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_reference.hpp"
#include "based/utility/forward.hpp"
namespace based
@@ -25,7 +25,7 @@
constexpr decltype(auto) max(T&& lhs, U&& rhs)
return based::max(
based::forward<T>(lhs),
based::forward<U>(rhs),
[](const RemoveReferenceT<T>& llhs, const RemoveReferenceT<U>& lrhs)
[](const trait::RemoveReference<T>& llhs, const trait::RemoveReference<U>& lrhs)
{
return llhs < lrhs;
}
diff --git a/ include/based/algorithm/min.hpp b/ include/based/algorithm/min.hpp
@@ -3,7 +3,7 @@
#include "based/concept/is/regular.hpp"
#include "based/concept/is/same.hpp"
#include "based/concept/procedure/procedure.hpp"
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_reference.hpp"
#include "based/utility/forward.hpp"
namespace based
@@ -24,7 +24,7 @@
constexpr decltype(auto) min(T&& lhs, U&& rhs)
return based::min(
based::forward<T>(lhs),
based::forward<U>(rhs),
[](const RemoveReferenceT<T>& llhs, const RemoveReferenceT<U>& lrhs)
[](const trait::RemoveReference<T>& llhs, const trait::RemoveReference<U>& lrhs)
{
return llhs < lrhs;
}
diff --git a/ include/based/concept/callable.hpp b/ include/based/concept/callable.hpp
@@ -2,7 +2,7 @@
#include "based/trait/decay.hpp"
#include "based/trait/is/function.hpp"
#include "based/trait/remove/pointer.hpp"
#include "based/trait/remove_pointer.hpp"
#include "based/trait/signature.hpp"
namespace based
@@ -13,19 +13,19 @@
struct callable;
template<typename T>
requires(is_function_v<T>)
struct callable<T> : public Signature<DecayT<T>>
struct callable<T> : public Signature<trait::Decay<T>>
{
};
template<typename T>
requires(requires { &DecayT<T>::operator(); })
requires(requires { &trait::Decay<T>::operator(); })
struct callable<T> : public Signature<decltype(&T::operator())>
{
};
template<typename T>
requires(std::is_member_function_pointer_v<DecayT<T>>)
struct callable<T> : public Signature<RemovePointerT<T>>
requires(std::is_member_function_pointer_v<trait::Decay<T>>)
struct callable<T> : public Signature<trait::RemovePointer<T>>
{
};
diff --git a/ include/based/concept/comparable/equal.hpp b/ include/based/concept/comparable/equal.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "based/concept/is/same.hpp"
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_reference.hpp"
namespace based
{
@@ -10,7 +10,7 @@
namespace based
template<typename T>
concept EqualComparable = requires(
const RemoveReferenceT<T>& lhs, const RemoveReferenceT<T>& rhs
const trait::RemoveReference<T>& lhs, const trait::RemoveReference<T>& rhs
) {
{ lhs == rhs } -> SameAs<bool>;
{ rhs == lhs } -> SameAs<bool>;
diff --git a/ include/based/concept/comparable/greater.hpp b/ include/based/concept/comparable/greater.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "based/concept/is/same.hpp"
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_reference.hpp"
namespace based
{
@@ -10,7 +10,7 @@
namespace based
template<typename T>
concept GreaterComparable = requires
(const RemoveReferenceT<T>& lhs, const RemoveReferenceT<T>& rhs)
(const trait::RemoveReference<T>& lhs, const trait::RemoveReference<T>& rhs)
{
{lhs > rhs} -> SameAs<bool>;
{rhs > lhs} -> SameAs<bool>;
diff --git a/ include/based/concept/comparable/greater_equal.hpp b/ include/based/concept/comparable/greater_equal.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "based/concept/is/same.hpp"
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_reference.hpp"
namespace based
{
@@ -10,7 +10,7 @@
namespace based
template<typename T>
concept LessEqualComparable = requires
(const RemoveReferenceT<T>& lhs, const RemoveReferenceT<T>& rhs)
(const trait::RemoveReference<T>& lhs, const trait::RemoveReference<T>& rhs)
{
{lhs <= rhs} -> SameAs<bool>;
{rhs <= lhs} -> SameAs<bool>;
diff --git a/ include/based/concept/comparable/less.hpp b/ include/based/concept/comparable/less.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "based/concept/is/same.hpp"
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_reference.hpp"
namespace based
{
@@ -10,7 +10,7 @@
namespace based
template<typename T>
concept LessComparable = requires
(const RemoveReferenceT<T>& lhs, const RemoveReferenceT<T>& rhs)
(const trait::RemoveReference<T>& lhs, const trait::RemoveReference<T>& rhs)
{
{lhs < rhs} -> SameAs<bool>;
{rhs < lhs} -> SameAs<bool>;
diff --git a/ include/based/concept/comparable/less_equal.hpp b/ include/based/concept/comparable/less_equal.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "based/concept/is/same.hpp"
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_reference.hpp"
namespace based
{
@@ -10,7 +10,7 @@
namespace based
template<typename T>
concept GreaterEqualComparable = requires
(const RemoveReferenceT<T>& lhs, const RemoveReferenceT<T>& rhs)
(const trait::RemoveReference<T>& lhs, const trait::RemoveReference<T>& rhs)
{
{lhs >= rhs} -> SameAs<bool>;
{rhs >= lhs} -> SameAs<bool>;
diff --git a/ include/based/concept/comparable/not_equal.hpp b/ include/based/concept/comparable/not_equal.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "based/concept/is/same.hpp"
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_reference.hpp"
namespace based
{
@@ -10,7 +10,7 @@
namespace based
template<typename T>
concept NotEqualComparable = requires
(const RemoveReferenceT<T>& lhs, const RemoveReferenceT<T>& rhs)
(const trait::RemoveReference<T>& lhs, const trait::RemoveReference<T>& rhs)
{
{lhs != rhs} -> SameAs<bool>;
{rhs != lhs} -> SameAs<bool>;
diff --git a/ include/based/concept/is/regular.hpp b/ include/based/concept/is/regular.hpp
@@ -2,7 +2,7 @@
#include <concepts>
#include "based/trait/remove/cvref.hpp"
#include "based/trait/remove_cvref.hpp"
namespace based
{
@@ -11,6 +11,6 @@
template<typename T>
concept Regular = std::regular<T>;
template<typename T>
concept BareRegular = Regular<RemoveCvrefT<T>>;
concept BareRegular = Regular<trait::RemoveCvref<T>>;
} // namespace based
diff --git a/ include/based/concept/is/same.hpp b/ include/based/concept/is/same.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "based/trait/is/same.hpp"
#include "based/trait/remove/cvref.hpp"
#include "based/trait/remove_cvref.hpp"
namespace based
{
@@ -10,6 +10,6 @@
template<class T, class U>
concept SameAs = is_same_v<T, U> && is_same_v<U, T>;
template<class T, class U>
concept BareSameAs = SameAs<RemoveCvrefT<T>, RemoveCvrefT<U>>;
concept BareSameAs = SameAs<trait::RemoveCvref<T>, trait::RemoveCvref<U>>;
} // namespace based
diff --git a/ include/based/concept/is/semiregular.hpp b/ include/based/concept/is/semiregular.hpp
@@ -2,7 +2,7 @@
#include <concepts>
#include "based/trait/remove/cvref.hpp"
#include "based/trait/remove_cvref.hpp"
namespace based
{
@@ -11,6 +11,6 @@
template<typename T>
concept Semiregular = std::semiregular<T>;
template<typename T>
concept BareSemiregular = Semiregular<RemoveCvrefT<T>>;
concept BareSemiregular = Semiregular<trait::RemoveCvref<T>>;
} // namespace based
diff --git a/ include/based/concept/procedure/domain.hpp b/ include/based/concept/procedure/domain.hpp
@@ -8,26 +8,26 @@
#include "based/integral/types.hpp"
#include "based/trait/invoke_result.hpp"
#include "based/trait/is/const.hpp"
#include "based/trait/remove/cvref.hpp"
#include "based/trait/remove/pointer.hpp"
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_cvref.hpp"
#include "based/trait/remove_pointer.hpp"
#include "based/trait/remove_reference.hpp"
namespace based
{
template<typename T>
concept Input = SameAs<T, RemoveCvrefT<RemovePointerT<T>>>
|| is_const_v<RemoveReferenceT<T>> || is_const_v<RemovePointerT<T>>;
concept Input = SameAs<T, trait::RemoveCvref<trait::RemovePointer<T>>>
|| is_const_v<trait::RemoveReference<T>> || is_const_v<trait::RemovePointer<T>>;
template<SizeT idx, typename... Args>
requires(idx < sizeof...(Args))
using ElemT = std::tuple_element_t<idx, std::tuple<Args...>>;
template<typename... Args>
concept SemiregularDomain = (Semiregular<RemoveCvrefT<Args>> && ...);
concept SemiregularDomain = (Semiregular<trait::RemoveCvref<Args>> && ...);
template<typename... Args>
concept RegularDomain = (Regular<RemoveCvrefT<Args>> && ...);
concept RegularDomain = (Regular<trait::RemoveCvref<Args>> && ...);
template<typename... Args>
concept InputDomain = (Input<Args> && ...);
diff --git a/ include/based/functional/function.hpp b/ include/based/functional/function.hpp
@@ -47,7 +47,7 @@
class Function<Ret(Args...), size, alignment>
public:
Function() = default;
template<typename CallableArg, typename Callable = DecayT<CallableArg>>
template<typename CallableArg, typename Callable = trait::Decay<CallableArg>>
requires(requires {
!SameAs<Function, Callable>;
sizeof(Callable) <= size;
diff --git a/ include/based/functional/invoke.hpp b/ include/based/functional/invoke.hpp
@@ -17,7 +17,7 @@
constexpr decltype(auto) invoke_memptr(
Pointed C::* member, Object&& object, Args&&... args
)
{
using ObjectT = RemoveCvrefT<Object>;
using ObjectT = trait::RemoveCvref<Object>;
constexpr bool is_member_function = is_function_v<Pointed>;
constexpr bool is_wrapped = false = is_reference_wrapper_v<ObjectT>;
constexpr bool is_derived_object = false =
@@ -55,7 +55,7 @@
constexpr decltype(auto) invoke(
F&& func, Args&&... args
) noexcept(is_nothrow_invocable_v<F, Args...>)
{
if constexpr (is_member_pointer_v<RemoveCvrefT<F>>) {
if constexpr (is_member_pointer_v<trait::RemoveCvref<F>>) {
return detail::invoke_memptr(func, based::forward<Args>(args)...);
}
diff --git a/ include/based/functional/reference_wrapper.hpp b/ include/based/functional/reference_wrapper.hpp
@@ -3,7 +3,7 @@
#include "based/memory/addressof.hpp"
#include "based/trait/is/invocable.hpp"
#include "based/trait/is/same.hpp"
#include "based/trait/remove/cvref.hpp"
#include "based/trait/remove_cvref.hpp"
#include "based/utility/declvar.hpp"
#include "based/utility/forward.hpp"
@@ -32,7 +32,7 @@
public:
template<class U>
requires(requires {
detail::fun<T>(declval<U>());
requires(!is_same_v<ReferenceWrapper, RemoveCvrefT<U>>);
requires(!is_same_v<ReferenceWrapper, trait::RemoveCvref<U>>);
})
// NOLINTNEXTLINE(*explicit*)
diff --git a/ include/based/trait/add/lvalue_reference.hpp b/ include/based/trait/add/lvalue_reference.hpp
@@ -1,27 +0,0 @@
#pragma once
#include "based/trait/type_identity.hpp"
namespace based
{
// clang-format off
namespace detail
{
// Note that “cv void&” is a substitution failure
template<class T> auto try_add(int) -> TypeIdentity<T&>;
// Handle T = cv void case
template<class T> auto try_add(...) -> TypeIdentity<T>;
} // namespace detail
template<class T> struct AddLvalueReference : decltype(detail::try_add<T>(0)) {};
template<class T> using AddLvalueReferenceT = AddLvalueReference<T>::Type;
// clang-format on
} // namespace based
diff --git a/ include/based/trait/add/pointer.hpp b/ include/based/trait/add/pointer.hpp
@@ -1,25 +0,0 @@
#pragma once
#include "based/trait/remove/reference.hpp"
#include "based/trait/type_identity.hpp"
namespace based
{
// clang-format off
namespace detail
{
template<class T> TypeIdentity<RemoveReferenceT<T>*> try_add_pointer(int);
template<class T> TypeIdentity<T> try_add_pointer(...);
} // namespace detail
template<class T> struct AddPointer : decltype(detail::try_add_pointer<T>(0)) {};
template<class T> using AddPointerT = AddPointer<T>::Type;
// clang-format on
} // namespace based
diff --git a/ include/based/trait/add/rvalue_reference.hpp b/ include/based/trait/add/rvalue_reference.hpp
@@ -1,27 +0,0 @@
#pragma once
#include "based/trait/type_identity.hpp"
namespace based
{
// clang-format off
namespace detail
{
// Note that “cv void&&” is a substitution failure
template<class T> auto try_add(int) -> TypeIdentity<T&&>;
// Handle T = cv void case
template<class T> auto try_add(...) -> TypeIdentity<T>;
} // namespace detail
template<class T> struct AddRvalueReference : decltype(detail::try_add<T>(0)) {};
template<class T> using AddRvalueReferenceT = AddRvalueReference<T>::Type;
// clang-format on
} // namespace based
diff --git a/ include/based/trait/add_lvalue_reference.hpp b/ include/based/trait/add_lvalue_reference.hpp
@@ -0,0 +1,27 @@
#pragma once
#include "based/trait/type_identity.hpp"
namespace based::trait
{
namespace detail
{
template<class T> // Note that “cv void&” is a substitution failure
auto try_add(int) -> TypeIdentity<T&>;
template<class T> // Handle T = cv void case
auto try_add(...) -> TypeIdentity<T>;
template<class T>
struct AddLvalueReference : decltype(detail::try_add<T>(0))
{
};
} // namespace detail
template<class T>
using AddLvalueReference = detail::AddLvalueReference<T>::Type;
} // namespace based::trait
diff --git a/ include/based/trait/add_pointer.hpp b/ include/based/trait/add_pointer.hpp
@@ -0,0 +1,28 @@
#pragma once
#include "based/trait/remove_reference.hpp"
#include "based/trait/type_identity.hpp"
namespace based::trait
{
namespace detail
{
template<class T>
auto try_add_pointer(int) -> TypeIdentity<trait::RemoveReference<T>*>;
template<class T>
auto try_add_pointer(...) -> TypeIdentity<T>;
template<class T>
struct AddPointer : decltype(detail::try_add_pointer<T>(0))
{
};
} // namespace detail
template<class T>
using AddPointer = typename detail::AddPointer<T>::Type;
} // namespace based::trait
diff --git a/ include/based/trait/add_rvalue_reference.hpp b/ include/based/trait/add_rvalue_reference.hpp
@@ -0,0 +1,29 @@
#pragma once
#include "based/trait/type_identity.hpp"
namespace based::trait
{
namespace detail
{
// Note that “cv void&&” is a substitution failure
template<class T>
auto try_add(int) -> TypeIdentity<T&&>;
// Handle T = cv void case
template<class T>
auto try_add(...) -> TypeIdentity<T>;
template<class T>
struct AddRvalueReference : decltype(detail::try_add<T>(0))
{
};
} // namespace detail
template<class T>
using AddRvalueReference = detail::AddRvalueReference<T>::Type;
} // namespace based::trait
diff --git a/ include/based/trait/conditional.hpp b/ include/based/trait/conditional.hpp
@@ -1,15 +1,19 @@
#pragma once
namespace based
namespace based::trait
{
// clang-format off
namespace detail
{
// clang-format off
template<bool b, class T, class F> struct Conditional { using Type = T; };
template<class T, class F> struct Conditional<false, T, F> { using Type = F; };
// clang-format on
template<bool b, class T, class F> using ConditionalT = Conditional<b, T, F>::Type;
} // namespace detail
// clang-format on
template<bool b, class T, class F>
using Conditional = typename detail::Conditional<b, T, F>::Type;
} // namespace based
} // namespace based::trait
diff --git a/ include/based/trait/decay.hpp b/ include/based/trait/decay.hpp
@@ -1,37 +1,41 @@
#pragma once
#include "based/trait/add/pointer.hpp"
#include "based/trait/conditional.hpp"
#include "based/trait/add_pointer.hpp"
#include "based/trait/is/array.hpp"
#include "based/trait/is/function.hpp"
#include "based/trait/remove/cv.hpp"
#include "based/trait/remove/extent.hpp"
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_cv.hpp"
#include "based/trait/remove_extent.hpp"
#include "based/trait/remove_reference.hpp"
namespace based
namespace based::trait
{
// clang-format off
namespace detail
{
template<class T>
template<class U>
struct Decay
{
private:
using U = RemoveReferenceT<T>;
public:
using Type = ConditionalT<
is_array_v<U>,
AddPointerT<RemoveExtentT<U>>,
ConditionalT<
is_function_v<U>,
AddPointerT<U>,
RemoveCvT<U>>
>;
using Type = trait::RemoveCv<U>;
};
template<class T> using DecayT = typename Decay<T>::Type;
template<class U>
requires is_array_v<U>
struct Decay<U>
{
using Type = trait::AddPointer<trait::RemoveExtent<U>>;
};
// clang-format on
template<class U>
requires is_function_v<U>
struct Decay<U>
{
using Type = trait::AddPointer<U>;
};
} // namespace detail
template<class T>
using Decay = typename detail::Decay<RemoveReference<T>>::Type;
} // namespace based
} // namespace based::trait
diff --git a/ include/based/trait/invoke_result.hpp b/ include/based/trait/invoke_result.hpp
@@ -23,15 +23,15 @@
template<class B, class MT>
struct InvokeImpl<MT B::*>
{
template<class T>
requires(is_base_of_v<B, DecayT<T>>)
requires(is_base_of_v<B, trait::Decay<T>>)
static auto get(T&& obj) -> T&&;
template<class T>
requires(is_reference_wrapper_v<DecayT<T>>)
requires(is_reference_wrapper_v<trait::Decay<T>>)
static auto get(T&& obj) -> decltype(obj.get());
template<class T>
requires(!is_base_of_v<B, DecayT<T>> && !is_reference_wrapper_v<DecayT<T>>)
requires(!is_base_of_v<B, trait::Decay<T>> && !is_reference_wrapper_v<trait::Decay<T>>)
static auto get(T&& obj) -> decltype(*based::forward<T>(obj));
template<class T, class... Args, class MT1>
@@ -47,7 +47,7 @@
struct InvokeImpl<MT B::*>
};
template<class F, class... Args>
auto invoke_f(F&& func, Args&&... args) -> decltype(InvokeImpl<DecayT<F>>::call(
auto invoke_f(F&& func, Args&&... args) -> decltype(InvokeImpl<trait::Decay<F>>::call(
based::forward<F>(func), based::forward<Args>(args)...
));
diff --git a/ include/based/trait/is/floating_point.hpp b/ include/based/trait/is/floating_point.hpp
@@ -2,7 +2,7 @@
#include "based/trait/integral_constant.hpp"
#include "based/trait/is/same.hpp"
#include "based/trait/remove/cv.hpp"
#include "based/trait/remove_cv.hpp"
namespace based
{
@@ -13,7 +13,7 @@
struct IsFloatingPoint : FalseType
};
template<class T>
requires(is_same_v<float, RemoveCvT<T>> || is_same_v<double, RemoveCvT<T>> || is_same_v<long double, RemoveCvT<T>>)
requires(is_same_v<float, trait::RemoveCv<T>> || is_same_v<double, trait::RemoveCv<T>> || is_same_v<long double, trait::RemoveCv<T>>)
struct IsFloatingPoint<T> : TrueType
{
};
diff --git a/ include/based/trait/is/member_pointer.hpp b/ include/based/trait/is/member_pointer.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "based/trait/integral_constant.hpp"
#include "based/trait/remove/cv.hpp"
#include "based/trait/remove_cv.hpp"
namespace based
{
@@ -22,7 +22,7 @@
struct IsMemberPointerHelper<T U::*> : TrueType
} // namespace detail
template<class T>
struct IsMemberPointer : detail::IsMemberPointerHelper<RemoveCvT<T>>
struct IsMemberPointer : detail::IsMemberPointerHelper<trait::RemoveCv<T>>
{
};
diff --git a/ include/based/trait/is/null_pointer.hpp b/ include/based/trait/is/null_pointer.hpp
@@ -2,13 +2,13 @@
#include "based/memory/nullptr.hpp"
#include "based/trait/is/same.hpp"
#include "based/trait/remove/cv.hpp"
#include "based/trait/remove_cv.hpp"
namespace based
{
template<class T>
struct IsNullPointer : IsSame<NullptrT, RemoveCvT<T>>
struct IsNullPointer : IsSame<NullptrT, trait::RemoveCv<T>>
{
};
diff --git a/ include/based/trait/is/void.hpp b/ include/based/trait/is/void.hpp
@@ -1,13 +1,13 @@
#pragma once
#include "based/trait/is/same.hpp"
#include "based/trait/remove/cv.hpp"
#include "based/trait/remove_cv.hpp"
namespace based
{
template<class T>
struct IsVoid : IsSame<void, RemoveCvT<T>>
struct IsVoid : IsSame<void, trait::RemoveCv<T>>
{
};
diff --git a/ include/based/trait/remove/const.hpp b/ include/based/trait/remove/const.hpp
@@ -1,15 +0,0 @@
#pragma once
namespace based
{
// clang-format off
template<class T> struct RemoveConst { using Type = T; };
template<class T> struct RemoveConst<const T> { using Type = T; };
template<class T> using RemoveConstT = typename RemoveConst<T>::Type;
// clang-format on
} // namespace based
diff --git a/ include/based/trait/remove/cv.hpp b/ include/based/trait/remove/cv.hpp
@@ -1,17 +0,0 @@
#pragma once
namespace based
{
// clang-format off
template<class T> struct RemoveCv { using Type = T; };
template<class T> struct RemoveCv<const T> { using Type = T; };
template<class T> struct RemoveCv<volatile T> { using Type = T; };
template<class T> struct RemoveCv<const volatile T> { using Type = T; };
template<class T> using RemoveCvT = typename RemoveCv<T>::Type;
// clang-format on
} // namespace based
diff --git a/ include/based/trait/remove/cvref.hpp b/ include/based/trait/remove/cvref.hpp
@@ -1,19 +0,0 @@
#pragma once
#include "based/trait/remove/cv.hpp"
#include "based/trait/remove/reference.hpp"
namespace based
{
// clang-format off
template<class T> struct RemoveCvref {
using Type = RemoveCvT<RemoveReferenceT<T>>;
};
template<class T> using RemoveCvrefT = typename RemoveCvref<T>::Type;
// clang-format on
} // namespace based
diff --git a/ include/based/trait/remove/extent.hpp b/ include/based/trait/remove/extent.hpp
@@ -1,26 +0,0 @@
#pragma once
#include "based/integral/types.hpp"
namespace based
{
// NOLINTBEGIN(*array*)
// clang-format off
template<class T>
struct RemoveExtent { using Type = T; };
template<class T>
struct RemoveExtent<T[]> { using Type = T; };
template<class T, SizeT n>
struct RemoveExtent<T[n]> { using Type = T; };
template<class T> using RemoveExtentT = RemoveExtent<T>::Type;
// NOLINTEND(*array*)
// clang-format on
} // namespace based
diff --git a/ include/based/trait/remove/pointer.hpp b/ include/based/trait/remove/pointer.hpp
@@ -1,18 +0,0 @@
#pragma once
namespace based
{
// clang-format off
template<class T> struct RemovePointer { using Type = T; };
template<class T> struct RemovePointer<T*> { using Type = T; };
template<class T> struct RemovePointer<T* const> { using Type = T; };
template<class T> struct RemovePointer<T* volatile> { using Type = T; };
template<class T> struct RemovePointer<T* const volatile> { using Type = T; };
template<class T> using RemovePointerT = typename RemovePointer<T>::Type;
// clang-format on
} // namespace based
diff --git a/ include/based/trait/remove/reference.hpp b/ include/based/trait/remove/reference.hpp
@@ -1,16 +0,0 @@
#pragma once
namespace based
{
// clang-format off
template<class T> struct RemoveReference { using Type = T; };
template<class T> struct RemoveReference<T&> { using Type = T; };
template<class T> struct RemoveReference<T&&> { using Type = T; };
template<class T> using RemoveReferenceT = typename RemoveReference<T>::Type;
// clang-format on
} // namespace based
diff --git a/ include/based/trait/remove/volatile.hpp b/ include/based/trait/remove/volatile.hpp
@@ -1,15 +0,0 @@
#pragma once
namespace based
{
// clang-format off
template<class T> struct RemoveVolatile { using Type = T; };
template<class T> struct RemoveVolatile<volatile T> { using Type = T; };
template<class T> using RemoveVolatileT = typename RemoveVolatile<T>::Type;
// clang-format on
} // namespace based
diff --git a/ include/based/trait/remove_const.hpp b/ include/based/trait/remove_const.hpp
@@ -0,0 +1,26 @@
#pragma once
namespace based::trait
{
namespace detail
{
template<class T>
struct RemoveConst
{
using Type = T;
};
template<class T>
struct RemoveConst<const T>
{
using Type = T;
};
} // namespace detail
template<class T>
using RemoveConst = typename detail::RemoveConst<T>::Type;
} // namespace based::trait
diff --git a/ include/based/trait/remove_cv.hpp b/ include/based/trait/remove_cv.hpp
@@ -0,0 +1,21 @@
#pragma once
namespace based::trait
{
namespace detail
{
// clang-format off
template<class T> struct RemoveCv { using Type = T; };
template<class T> struct RemoveCv<const T> { using Type = T; };
template<class T> struct RemoveCv<volatile T> { using Type = T; };
template<class T> struct RemoveCv<const volatile T> { using Type = T; };
// clang-format on
} // namespace detail
template<class T>
using RemoveCv = typename detail::RemoveCv<T>::Type;
} // namespace based::trait
diff --git a/ include/based/trait/remove_cvref.hpp b/ include/based/trait/remove_cvref.hpp
@@ -0,0 +1,23 @@
#pragma once
#include "based/trait/remove_reference.hpp"
#include "based/trait/remove_cv.hpp"
namespace based::trait
{
namespace detail
{
template<class T>
struct RemoveCvref
{
using Type = trait::RemoveCv<trait::RemoveReference<T>>;
};
} // namespace detail
template<class T>
using RemoveCvref = typename detail::RemoveCvref<T>::Type;
} // namespace based::trait
diff --git a/ include/based/trait/remove_extent.hpp b/ include/based/trait/remove_extent.hpp
@@ -0,0 +1,24 @@
#pragma once
#include "based/integral/types.hpp"
namespace based::trait
{
namespace detail
{
// NOLINTBEGIN(*array*)
// clang-format off
template<class T> struct RemoveExtent { using Type = T; };
template<class T> struct RemoveExtent<T[]> { using Type = T; };
template<class T, SizeT n> struct RemoveExtent<T[n]> { using Type = T; };
// NOLINTEND(*array*)
// clang-format on
} // namespace detail
template<class T>
using RemoveExtent = typename detail::RemoveExtent<T>::Type;
} // namespace based::trait
diff --git a/ include/based/trait/remove_pointer.hpp b/ include/based/trait/remove_pointer.hpp
@@ -0,0 +1,22 @@
#pragma once
namespace based::trait
{
namespace detail
{
// clang-format off
template<class T> struct RemovePointer { using Type = T; };
template<class T> struct RemovePointer<T*> { using Type = T; };
template<class T> struct RemovePointer<T* const> { using Type = T; };
template<class T> struct RemovePointer<T* volatile> { using Type = T; };
template<class T> struct RemovePointer<T* const volatile> { using Type = T; };
// clang-format on
} // namespace detail
template<class T>
using RemovePointer = typename detail::RemovePointer<T>::Type;
} // namespace based::trait
diff --git a/ include/based/trait/remove_reference.hpp b/ include/based/trait/remove_reference.hpp
@@ -0,0 +1,20 @@
#pragma once
namespace based::trait
{
namespace detail
{
// clang-format off
template<class T> struct RemoveReference { using Type = T; };
template<class T> struct RemoveReference<T&> { using Type = T; };
template<class T> struct RemoveReference<T&&> { using Type = T; };
// clang-format on
} // namespace detail
template<class T>
using RemoveReference = typename detail::RemoveReference<T>::Type;
} // namespace based::trait
diff --git a/ include/based/trait/remove_volatile.hpp b/ include/based/trait/remove_volatile.hpp
@@ -0,0 +1,19 @@
#pragma once
namespace based::trait
{
namespace detail
{
// clang-format off
template<class T> struct RemoveVolatile { using Type = T; };
template<class T> struct RemoveVolatile<volatile T> { using Type = T; };
// clang-format on
} // namespace detail
template<class T>
using RemoveVolatile = typename detail::RemoveVolatile<T>::Type;
} // namespace based::trait
diff --git a/ include/based/trait/signature.hpp b/ include/based/trait/signature.hpp
@@ -235,7 +235,7 @@
struct SignatureStatic<Ret (*)(Args...) noexcept(ne)>
};
template<typename F, typename Op>
using SignatureT = typename ConditionalT<requires(F& func) {
using SignatureT = typename trait::Conditional<requires(F& func) {
(void)func.operator();
}, SignatureStatic<Op>, Signature<Op>>::SigType;
diff --git a/ include/based/trait/type_identity.hpp b/ include/based/trait/type_identity.hpp
@@ -1,14 +1,18 @@
#pragma once
namespace based
namespace based::trait
{
// clang-format off
namespace detail
{
// clang-format off
template<class T> struct TypeIdentity { using Type = T; };
// clang-format on
template<class T> using TypeDentityT = TypeIdentity<T>::Type;
} // namespace detail
// clang-format on
template<class T>
using TypeIdentity = detail::TypeIdentity<T>::Type;
} // namespace based
} // namespace based::trait
diff --git a/ include/based/utility/declvar.hpp b/ include/based/utility/declvar.hpp
@@ -1,12 +1,12 @@
#pragma once
#include "based/trait/add/rvalue_reference.hpp"
#include "based/trait/add_rvalue_reference.hpp"
namespace based
{
template<typename T>
AddRvalueReferenceT<T> declval() noexcept
trait::AddRvalueReference<T> declval() noexcept
{
static_assert(false, "declval not allowed in an evaluated context");
}
diff --git a/ include/based/utility/forward.hpp b/ include/based/utility/forward.hpp
@@ -1,20 +1,20 @@
#pragma once
#include "based/trait/is/lvalue_reference.hpp"
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_reference.hpp"
namespace based
{
template<class T>
constexpr decltype(auto) forward(RemoveReferenceT<T>& tmp) noexcept
constexpr decltype(auto) forward(trait::RemoveReference<T>& tmp) noexcept
{
return static_cast<T&&>(tmp);
}
template<class T>
// NOLINTNEXTLINE(*move*)
constexpr decltype(auto) forward(RemoveReferenceT<T>&& tmp) noexcept
constexpr decltype(auto) forward(trait::RemoveReference<T>&& tmp) noexcept
{
static_assert(!is_lvalue_reference_v<T>);
return static_cast<T&&>(tmp);
diff --git a/ include/based/utility/move.hpp b/ include/based/utility/move.hpp
@@ -1,6 +1,6 @@
#pragma once
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_reference.hpp"
namespace based
{
@@ -9,7 +9,7 @@
template<class T>
// NOLINTNEXTLINE(*forward*)
constexpr decltype(auto) move(T&& tmp) noexcept
{
return static_cast<RemoveReferenceT<T>&&>(tmp);
return static_cast<trait::RemoveReference<T>&&>(tmp);
}
} // namespace based
diff --git a/ include/based/utility/static_view.hpp b/ include/based/utility/static_view.hpp
@@ -47,7 +47,7 @@
constexpr auto to_right_sized_array(auto callable)
{
constexpr auto oversized = to_oversized_array(callable());
using value_type = typename DecayT<decltype(oversized)>::value_type;
using value_type = typename trait::Decay<decltype(oversized)>::value_type;
std::array<value_type, oversized.size> result {};
std::ranges::copy(oversized, std::begin(result));
return result;
@@ -57,7 +57,7 @@
consteval auto to_string_view(auto callable)
{
constexpr auto& static_data = make_static<to_right_sized_array(callable)>;
using value_type = typename DecayT<decltype(static_data)>::value_type;
using value_type = typename trait::Decay<decltype(static_data)>::value_type;
const std::basic_string_view<value_type> result = {
std::begin(static_data), std::end(static_data)
};
@@ -68,7 +68,7 @@
consteval auto to_span(auto callable)
{
constexpr auto& static_data = make_static<to_right_sized_array(callable)>;
using value_type = typename DecayT<decltype(static_data)>::value_type;
using value_type = typename trait::Decay<decltype(static_data)>::value_type;
std::span<const value_type> result(static_data.begin(), static_data.end());
return result;
}
diff --git a/ test/source/concept/callable_test.cpp b/ test/source/concept/callable_test.cpp
@@ -5,6 +5,7 @@
#include <catch2/catch_test_macros.hpp>
#include "based/concept/is/same.hpp"
#include "based/trait/remove_extent.hpp"
namespace
{
@@ -41,20 +42,20 @@
TEST_CASE("lambda", "[concept/callable]")
STATIC_REQUIRE(SameAs<based::CallableRetT<TypeT>, int>);
}
/*
struct func
struct Func
{
auto operator()(auto a, auto b) { return static_cast<int>(a + b); }
};
/*
TEST_CASE("member function", "[concept/callable]")
{
// [&](auto&&... args) -> decltype(auto) { return
// f(based::forward<decltype(args)>(args)...); }
// based::error_template<decltype(&func::template operator()<int, double>)>();
STATIC_REQUIRE(based::Callable<func>);
STATIC_REQUIRE(SameAs<based::CallableSigT<func>, int(int, double)>);
STATIC_REQUIRE(SameAs<based::CallableRetT<func>, int>);
STATIC_REQUIRE(based::Callable<Func>);
STATIC_REQUIRE(SameAs<based::CallableSigT<Func>, int(int, double)>);
STATIC_REQUIRE(SameAs<based::CallableRetT<Func>, int>);
}
*/
diff --git a/ test/source/trait/remove_const_test.cpp b/ test/source/trait/remove_const_test.cpp
@@ -3,7 +3,7 @@
#include <catch2/catch_test_macros.hpp>
#include "based/concept/is/same.hpp"
#include "based/trait/remove/const.hpp"
#include "based/trait/remove_const.hpp"
using based::SameAs;
@@ -11,27 +11,27 @@
TEST_CASE("remove_const", "[trait/remove/remove_const]")
{
// NOLINTBEGIN(*array*)
// clang-format off
STATIC_REQUIRE(SameAs<based::RemoveConstT<int>, int>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<int&>, int&>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<int&&>, int&&>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<int(&)[2]>, int(&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<int(&&)[2]>, int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<const int>, int>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<const int&>, const int&>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<const int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<const int(&)[2]>, const int(&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<volatile int>, volatile int>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<volatile int&>, volatile int&>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<volatile int&&>, volatile int&&>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<volatile int[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<volatile int(&)[2]>, volatile int(&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<volatile int(&&)[2]>, volatile int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<const volatile int>, volatile int>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<const volatile int&>, volatile const int&>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<const volatile int[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveConstT<const volatile int(&)[2]>, volatile const int(&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<int&>, int&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<int&&>, int&&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<int(&)[2]>, int(&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<int(&&)[2]>, int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<const int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<const int&>, const int&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<const int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<const int(&)[2]>, const int(&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<volatile int>, volatile int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<volatile int&>, volatile int&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<volatile int&&>, volatile int&&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<volatile int[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<volatile int(&)[2]>, volatile int(&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<volatile int(&&)[2]>, volatile int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<const volatile int>, volatile int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<const volatile int&>, volatile const int&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<const volatile int[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveConst<const volatile int(&)[2]>, volatile const int(&)[2]>);
// clang-format on
// NOLINTEND(*array*)
}
diff --git a/ test/source/trait/remove_cv_test.cpp b/ test/source/trait/remove_cv_test.cpp
@@ -3,7 +3,7 @@
#include <catch2/catch_test_macros.hpp>
#include "based/concept/is/same.hpp"
#include "based/trait/remove/cv.hpp"
#include "based/trait/remove_cv.hpp"
using based::SameAs;
@@ -11,27 +11,27 @@
TEST_CASE("remove_cv", "[trait/remove_cv]")
{
// NOLINTBEGIN(*array*)
// clang-format off
STATIC_REQUIRE(SameAs<based::RemoveCvT<int>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<int&>, int&>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<int&&>, int&&>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<int(&)[2]>, int(&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<int(&&)[2]>, int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<const int>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<const int&>, const int&>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<const int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<const int(&)[2]>, const int(&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<volatile int>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<volatile int&>, volatile int&>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<volatile int&&>, volatile int&&>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<volatile int(&)[2]>, volatile int(&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<volatile int(&&)[2]>, volatile int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<const volatile int>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<const volatile int&>, volatile const int&>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<const volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvT<const volatile int(&)[2]>, volatile const int(&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<int&>, int&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<int&&>, int&&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<int(&)[2]>, int(&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<int(&&)[2]>, int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<const int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<const int&>, const int&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<const int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<const int(&)[2]>, const int(&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<volatile int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<volatile int&>, volatile int&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<volatile int&&>, volatile int&&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<volatile int(&)[2]>, volatile int(&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<volatile int(&&)[2]>, volatile int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<const volatile int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<const volatile int&>, volatile const int&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<const volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCv<const volatile int(&)[2]>, volatile const int(&)[2]>);
// clang-format on
// NOLINTEND(*array*)
}
diff --git a/ test/source/trait/remove_cvref_test.cpp b/ test/source/trait/remove_cvref_test.cpp
@@ -3,7 +3,7 @@
#include <catch2/catch_test_macros.hpp>
#include "based/concept/is/same.hpp"
#include "based/trait/remove/cvref.hpp"
#include "based/trait/remove_cvref.hpp"
using based::SameAs;
@@ -11,27 +11,27 @@
TEST_CASE("remove_cvref", "[trait/remove_cvref]")
{
// NOLINTBEGIN(*array*)
// clang-format off
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<int>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<int&>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<int&&>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<int(&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<int(&&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<const int>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<const int&>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<const int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<const int(&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<volatile int>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<volatile int&>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<volatile int&&>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<volatile int(&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<volatile int(&&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<const volatile int>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<const volatile int&>, int>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<const volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveCvrefT<const volatile int(&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<int&>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<int&&>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<int(&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<int(&&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<const int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<const int&>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<const int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<const int(&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<volatile int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<volatile int&>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<volatile int&&>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<volatile int(&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<volatile int(&&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<const volatile int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<const volatile int&>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<const volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveCvref<const volatile int(&)[2]>, int[2]>);
// clang-format on
// NOLINTEND(*array*)
}
diff --git a/ test/source/trait/remove_pointer_test.cpp b/ test/source/trait/remove_pointer_test.cpp
@@ -3,7 +3,7 @@
#include <catch2/catch_test_macros.hpp>
#include "based/concept/is/same.hpp"
#include "based/trait/remove/pointer.hpp"
#include "based/trait/remove_pointer.hpp"
using based::SameAs;
@@ -11,12 +11,12 @@
TEST_CASE("remove_pointer", "[trait/remove_pointer]")
{
// NOLINTBEGIN(*array*)
// clang-format off
STATIC_REQUIRE(SameAs<based::RemovePointerT<int>, int>);
STATIC_REQUIRE(SameAs<based::RemovePointerT<int*>, int>);
STATIC_REQUIRE(SameAs<based::RemovePointerT<int**>, int*>);
STATIC_REQUIRE(SameAs<based::RemovePointerT<int* const>, int>);
STATIC_REQUIRE(SameAs<based::RemovePointerT<int* volatile>, int>);
STATIC_REQUIRE(SameAs<based::RemovePointerT<int* const volatile>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemovePointer<int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemovePointer<int*>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemovePointer<int**>, int*>);
STATIC_REQUIRE(SameAs<based::trait::RemovePointer<int* const>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemovePointer<int* volatile>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemovePointer<int* const volatile>, int>);
// clang-format on
// NOLINTEND(*array*)
}
diff --git a/ test/source/trait/remove_reference_test.cpp b/ test/source/trait/remove_reference_test.cpp
@@ -3,7 +3,7 @@
#include <catch2/catch_test_macros.hpp>
#include "based/concept/is/same.hpp"
#include "based/trait/remove/reference.hpp"
#include "based/trait/remove_reference.hpp"
using based::SameAs;
@@ -11,27 +11,27 @@
TEST_CASE("remove_reference", "[trait/remove_reference]")
{
// NOLINTBEGIN(*array*)
// clang-format off
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<int>, int>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<int&>, int>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<int&&>, int>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<int(&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<int(&&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<const int>, const int>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<const int&>, const int>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<const int[2]>, const int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<const int(&)[2]>, const int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<volatile int>,volatile int>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<volatile int&>, volatile int>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<volatile int&&>, volatile int>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<volatile int[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<volatile int(&)[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<volatile int(&&)[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<const volatile int>, const volatile int>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<const volatile int&>, volatile const int>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<const volatile int[2]>, const volatile int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveReferenceT<const volatile int(&)[2]>, volatile const int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<int&>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<int&&>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<int(&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<int(&&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<const int>, const int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<const int&>, const int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<const int[2]>, const int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<const int(&)[2]>, const int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<volatile int>,volatile int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<volatile int&>, volatile int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<volatile int&&>, volatile int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<volatile int[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<volatile int(&)[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<volatile int(&&)[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<const volatile int>, const volatile int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<const volatile int&>, volatile const int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<const volatile int[2]>, const volatile int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveReference<const volatile int(&)[2]>, volatile const int[2]>);
// clang-format on
// NOLINTEND(*array*)
}
diff --git a/ test/source/trait/remove_volatile_test.cpp b/ test/source/trait/remove_volatile_test.cpp
@@ -3,7 +3,7 @@
#include <catch2/catch_test_macros.hpp>
#include "based/concept/is/same.hpp"
#include "based/trait/remove/volatile.hpp"
#include "based/trait/remove_volatile.hpp"
using based::SameAs;
@@ -11,27 +11,27 @@
TEST_CASE("remove_volatile", "[trait/remove/remove_volatile]")
{
// NOLINTBEGIN(*array*)
// clang-format off
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<int>, int>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<int&>, int&>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<int&&>, int&&>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<int(&)[2]>, int(&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<int(&&)[2]>, int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<const int>, const int>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<const int&>, const int&>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<const int[2]>, const int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<const int(&)[2]>, const int(&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<volatile int>, int>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<volatile int&>, volatile int&>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<volatile int&&>, volatile int&&>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<volatile int(&)[2]>, volatile int(&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<volatile int(&&)[2]>, volatile int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<const volatile int>, const int>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<const volatile int&>, volatile const int&>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<const volatile int[2]>, const int[2]>);
STATIC_REQUIRE(SameAs<based::RemoveVolatileT<const volatile int(&)[2]>, volatile const int(&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<int&>, int&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<int&&>, int&&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<int(&)[2]>, int(&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<int(&&)[2]>, int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<const int>, const int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<const int&>, const int&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<const int[2]>, const int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<const int(&)[2]>, const int(&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<volatile int>, int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<volatile int&>, volatile int&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<volatile int&&>, volatile int&&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<volatile int(&)[2]>, volatile int(&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<volatile int(&&)[2]>, volatile int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<const volatile int>, const int>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<const volatile int&>, volatile const int&>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<const volatile int[2]>, const int[2]>);
STATIC_REQUIRE(SameAs<based::trait::RemoveVolatile<const volatile int(&)[2]>, volatile const int(&)[2]>);
// clang-format on
// NOLINTEND(*array*)
}