basedOpinionated utility library |
git clone git://git.dimitrijedobrota.com/based.git |
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING |
commit | dd83f467be9aa956477d4a0f6f71e96221701b15 |
parent | 55da0463f98cbe0f2d5fc39a77faf8ee8d28f7cc |
author | Dimitrije Dobrota < mail@dimitrijedobrota.com > |
date | Fri, 20 Jun 2025 09:23:46 +0200 |
Rename type aliases
103 files changed, 1041 insertions(+), 1038 deletions(-)
diff --git a/ .clang-tidy b/ .clang-tidy
@@ -151,9 +151,9 @@
CheckOptions:
- key: 'readability-identifier-naming.TemplateTemplateParameterCase'
value: 'CamelCase'
- key: 'readability-identifier-naming.TypeAliasCase'
value: 'lower_case'
value: 'CamelCase'
- key: 'readability-identifier-naming.TypeAliasIgnoredRegexp'
value: 'N'
value: '(difference_type|value_type|pointer|const_pointer|reference|const_reference|iterator|const_iterator|reverse_iterator|const_reverse_iterator)'
- key: 'readability-identifier-naming.TypedefCase'
value: 'lower_case'
- key: 'readability-identifier-naming.TypeTemplateParameterCase'
diff --git a/ include/based/algorithm/clamp.hpp b/ include/based/algorithm/clamp.hpp
@@ -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 remove_reference_t<T>& llhs, const remove_reference_t<U>& lrhs)
[](const RemoveReferenceT<T>& llhs, const RemoveReferenceT<U>& lrhs)
{
return llhs < lrhs;
}
diff --git a/ include/based/algorithm/max.hpp b/ include/based/algorithm/max.hpp
@@ -25,7 +25,7 @@
constexpr decltype(auto) max(T&& lhs, U&& rhs)
return based::max(
based::forward<T>(lhs),
based::forward<U>(rhs),
[](const remove_reference_t<T>& llhs, const remove_reference_t<U>& lrhs)
[](const RemoveReferenceT<T>& llhs, const RemoveReferenceT<U>& lrhs)
{
return llhs < lrhs;
}
diff --git a/ include/based/algorithm/min.hpp b/ include/based/algorithm/min.hpp
@@ -24,7 +24,7 @@
constexpr decltype(auto) min(T&& lhs, U&& rhs)
return based::min(
based::forward<T>(lhs),
based::forward<U>(rhs),
[](const remove_reference_t<T>& llhs, const remove_reference_t<U>& lrhs)
[](const RemoveReferenceT<T>& llhs, const RemoveReferenceT<U>& lrhs)
{
return llhs < lrhs;
}
diff --git a/ include/based/character/format.hpp b/ include/based/character/format.hpp
@@ -19,7 +19,7 @@
struct std::formatter<based::character>
}
};
inline std::ostream& operator<<(std::ostream& ost, based::character value)
inline std::ostream& operator<<(std::ostream& ost, based::Character value)
{
return ost << value.chr();
}
diff --git a/ include/based/character/is/alnum.hpp b/ include/based/character/is/alnum.hpp
@@ -1,13 +1,13 @@
#pragma once
#include "based/character/type.hpp"
#include "based/character/is/alpha.hpp"
#include "based/character/is/digit.hpp"
#include "based/character/type.hpp"
namespace based
{
constexpr bool is_alnum(character chr)
constexpr bool is_alnum(Character chr)
{
return is_alpha(chr) || is_digit(chr);
}
diff --git a/ include/based/character/is/alpha.hpp b/ include/based/character/is/alpha.hpp
@@ -1,13 +1,13 @@
#pragma once
#include "based/character/type.hpp"
#include "based/character/is/alpha_lower.hpp"
#include "based/character/is/alpha_upper.hpp"
#include "based/character/type.hpp"
namespace based
{
constexpr bool is_alpha(character chr)
constexpr bool is_alpha(Character chr)
{
return is_alpha_lower(chr) || is_alpha_upper(chr);
}
diff --git a/ include/based/character/is/alpha_lower.hpp b/ include/based/character/is/alpha_lower.hpp
@@ -5,7 +5,7 @@
namespace based
{
constexpr bool is_alpha_lower(character chr)
constexpr bool is_alpha_lower(Character chr)
{
return chr >= 'a' && chr <= 'z';
}
diff --git a/ include/based/character/is/alpha_upper.hpp b/ include/based/character/is/alpha_upper.hpp
@@ -5,7 +5,7 @@
namespace based
{
constexpr bool is_alpha_upper(character chr)
constexpr bool is_alpha_upper(Character chr)
{
return chr >= 'A' && chr <= 'Z';
}
diff --git a/ include/based/character/is/digit.hpp b/ include/based/character/is/digit.hpp
@@ -5,10 +5,9 @@
namespace based
{
constexpr bool is_digit(character chr)
constexpr bool is_digit(Character chr)
{
return chr >= '0' && chr <= '9';
}
} // namespace based
diff --git a/ include/based/character/is/xdigit.hpp b/ include/based/character/is/xdigit.hpp
@@ -5,7 +5,7 @@
namespace based
{
constexpr bool is_xdigit(character chr)
constexpr bool is_xdigit(Character chr)
{
return (chr >= 'a' && chr <= 'f') || (chr >= 'A' && chr <= 'F')
|| (chr >= '0' && chr <= '9');
diff --git a/ include/based/character/mapper.hpp b/ include/based/character/mapper.hpp
@@ -12,16 +12,16 @@
template<Predicate<Character> Predicate>
class Mapper
{
static constexpr auto size = limits<U8>::max;
using mapped_type = U8;
using MappedType = U8;
static constexpr Predicate m_predicate = {};
using direct_t = Array<mapped_type, U8, size>;
static constexpr direct_t direct = []
using DirectT = Array<MappedType, U8, size>;
static constexpr DirectT direct = []
{
direct_t res = {};
DirectT res = {};
mapped_type count = 0_u8;
MappedType count = 0_u8;
for (auto idx = 0_u8; idx < size; idx++) {
if (m_predicate(Character::cast(idx))) {
res[idx] = count++;
@@ -33,7 +33,7 @@
class Mapper
static constexpr const U8 count = []
{
mapped_type count = 0_u8;
MappedType count = 0_u8;
for (auto idx = 0_u8; idx < size; idx++) {
if (m_predicate(Character::cast(idx))) {
count++;
@@ -42,12 +42,12 @@
class Mapper
return count;
}();
using reverse_t = Array<Character, U8, count>;
static constexpr reverse_t reverse = []
using ReverseT = Array<Character, U8, count>;
static constexpr ReverseT reverse = []
{
reverse_t res = {};
ReverseT res = {};
mapped_type count = 0_u8;
MappedType count = 0_u8;
for (auto idx = 0_u8; idx < size; idx++) {
const auto chr = Character::cast(idx);
if (m_predicate(chr)) {
@@ -60,8 +60,8 @@
class Mapper
public:
static constexpr bool predicate(Character chr) { return m_predicate(chr); }
static constexpr Character map(mapped_type value) { return reverse[value]; }
static constexpr mapped_type map(Character chr) { return direct[chr.ord()]; }
static constexpr Character map(MappedType value) { return reverse[value]; }
static constexpr MappedType map(Character chr) { return direct[chr.ord()]; }
};
} // namespace based
diff --git a/ include/based/concept/callable.hpp b/ include/based/concept/callable.hpp
@@ -13,19 +13,19 @@
struct callable;
template<typename T>
requires(is_function_v<T>)
struct callable<T> : public Signature<decay_t<T>>
struct callable<T> : public Signature<DecayT<T>>
{
};
template<typename T>
requires(requires { &decay_t<T>::operator(); })
requires(requires { &DecayT<T>::operator(); })
struct callable<T> : public Signature<decltype(&T::operator())>
{
};
template<typename T>
requires(std::is_member_function_pointer_v<decay_t<T>>)
struct callable<T> : public Signature<remove_pointer_t<T>>
requires(std::is_member_function_pointer_v<DecayT<T>>)
struct callable<T> : public Signature<RemovePointerT<T>>
{
};
@@ -34,9 +34,9 @@
template<typename T>
concept Callable = true;
template<Callable T>
using callable_sig_t = typename callable<T>::Signature::sig_type;
using CallableSigT = typename callable<T>::Signature::SigType;
template<Callable T>
using callable_ret_t = typename callable<T>::Signature::ret_type;
using CallableRetT = typename callable<T>::Signature::RetType;
} // namespace based
diff --git a/ include/based/concept/comparable/equal.hpp b/ include/based/concept/comparable/equal.hpp
@@ -10,7 +10,7 @@
namespace based
template<typename T>
concept EqualComparable = requires(
const remove_reference_t<T>& lhs, const remove_reference_t<T>& rhs
const RemoveReferenceT<T>& lhs, const RemoveReferenceT<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
@@ -10,7 +10,7 @@
namespace based
template<typename T>
concept GreaterComparable = requires
(const remove_reference_t<T>& lhs, const remove_reference_t<T>& rhs)
(const RemoveReferenceT<T>& lhs, const RemoveReferenceT<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
@@ -10,7 +10,7 @@
namespace based
template<typename T>
concept LessEqualComparable = requires
(const remove_reference_t<T>& lhs, const remove_reference_t<T>& rhs)
(const RemoveReferenceT<T>& lhs, const RemoveReferenceT<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
@@ -10,7 +10,7 @@
namespace based
template<typename T>
concept LessComparable = requires
(const remove_reference_t<T>& lhs, const remove_reference_t<T>& rhs)
(const RemoveReferenceT<T>& lhs, const RemoveReferenceT<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
@@ -10,7 +10,7 @@
namespace based
template<typename T>
concept GreaterEqualComparable = requires
(const remove_reference_t<T>& lhs, const remove_reference_t<T>& rhs)
(const RemoveReferenceT<T>& lhs, const RemoveReferenceT<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
@@ -10,7 +10,7 @@
namespace based
template<typename T>
concept NotEqualComparable = requires
(const remove_reference_t<T>& lhs, const remove_reference_t<T>& rhs)
(const RemoveReferenceT<T>& lhs, const RemoveReferenceT<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
@@ -11,6 +11,6 @@
template<typename T>
concept Regular = std::regular<T>;
template<typename T>
concept BareRegular = Regular<remove_cvref_t<T>>;
concept BareRegular = Regular<RemoveCvrefT<T>>;
} // namespace based
diff --git a/ include/based/concept/is/same.hpp b/ include/based/concept/is/same.hpp
@@ -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<remove_cvref_t<T>, remove_cvref_t<U>>;
concept BareSameAs = SameAs<RemoveCvrefT<T>, RemoveCvrefT<U>>;
} // namespace based
diff --git a/ include/based/concept/is/semiregular.hpp b/ include/based/concept/is/semiregular.hpp
@@ -11,6 +11,6 @@
template<typename T>
concept Semiregular = std::semiregular<T>;
template<typename T>
concept BareSemiregular = Semiregular<remove_cvref_t<T>>;
concept BareSemiregular = Semiregular<RemoveCvrefT<T>>;
} // namespace based
diff --git a/ include/based/concept/procedure/domain.hpp b/ include/based/concept/procedure/domain.hpp
@@ -5,36 +5,37 @@
#include "based/concept/is/regular.hpp"
#include "based/concept/is/same.hpp"
#include "based/concept/is/semiregular.hpp"
#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/integral/types.hpp"
namespace based
{
template<typename T>
concept Input = SameAs<T, remove_cvref_t<remove_pointer_t<T>>>
|| is_const_v<remove_reference_t<T>> || is_const_v<remove_pointer_t<T>>;
concept Input = SameAs<T, RemoveCvrefT<RemovePointerT<T>>>
|| is_const_v<RemoveReferenceT<T>> || is_const_v<RemovePointerT<T>>;
template<size_t idx, typename... Args>
template<SizeT idx, typename... Args>
requires(idx < sizeof...(Args))
using elem_t = std::tuple_element_t<idx, std::tuple<Args...>>;
using ElemT = std::tuple_element_t<idx, std::tuple<Args...>>;
template<typename... Args>
concept SemiregularDomain = (Semiregular<remove_cvref_t<Args>> && ...);
concept SemiregularDomain = (Semiregular<RemoveCvrefT<Args>> && ...);
template<typename... Args>
concept RegularDomain = (Regular<remove_cvref_t<Args>> && ...);
concept RegularDomain = (Regular<RemoveCvrefT<Args>> && ...);
template<typename... Args>
concept InputDomain = (Input<Args> && ...);
template<typename... Args>
concept HomogeneousDomain = (SameAs<elem_t<0, Args...>, Args> && ...);
concept HomogeneousDomain = (SameAs<ElemT<0, Args...>, Args> && ...);
template<typename P, typename... Args>
using ret_t = std::invoke_result_t<P, Args...>;
using RetT = InvokeResultT<P, Args...>;
} // namespace based
diff --git a/ include/based/concept/procedure/procedure.hpp b/ include/based/concept/procedure/procedure.hpp
@@ -15,15 +15,15 @@
namespace detail
// clang-format off
template<typename P, typename Sig> struct Procedure : public false_type {};
template<typename P, typename Sig> struct Procedure : public FalseType {};
template<typename P, typename Ret, typename... Args>
requires (Invocable<P, Args...> && ConvertibleTo<invoke_result_t<P, Args...>, Ret>)
struct Procedure<P, Ret(Args...)> : public true_type {};
requires (Invocable<P, Args...> && ConvertibleTo<InvokeResultT<P, Args...>, Ret>)
struct Procedure<P, Ret(Args...)> : public TrueType {};
template<typename P, typename... Args>
requires (Invocable<P, Args...>)
struct Procedure<P, void(Args...)> : public true_type {};
struct Procedure<P, void(Args...)> : public TrueType {};
template<typename P, typename Ret, typename... Args>
static constexpr bool procedure_v = Procedure<P, Ret(Args...)>::value;
@@ -42,7 +42,7 @@
template<typename P, typename Ret, typename... Args>
concept RegularProcedure = requires {
requires(Procedure<P, Ret, Args...>);
requires(RegularDomain<Args...>);
requires(Regular<ret_t<P, Args...>>);
requires(Regular<RetT<P, Args...>>);
};
} // namespace based
diff --git a/ include/based/container/array.hpp b/ include/based/container/array.hpp
@@ -10,60 +10,60 @@
namespace based
template<class T, class U, U n>
class Array : public std::array<T, U64::cast(n).value>
{
using base = std::array<T, U64::cast(n).value>;
using Base = std::array<T, U64::cast(n).value>;
static constexpr auto cast(U pos)
{
return static_cast<base::size_type>(pos.value);
return static_cast<Base::size_type>(pos.value);
}
static constexpr auto cast(base::size_type pos)
static constexpr auto cast(Base::size_type pos)
{
return static_cast<U>(pos.value);
}
public:
using const_iterator = base::const_iterator;
using const_pointer = base::const_pointer;
using const_reference = base::const_reference;
using const_reverse_iterator = base::const_reverse_iterator;
using iterator = base::iterator;
using pointer = base::pointer;
using reference = base::reference;
using reverse_iterator = base::reverse_iterator;
using value_type = base::value_type;
using const_iterator = Base::const_iterator;
using const_pointer = Base::const_pointer;
using const_reference = Base::const_reference;
using const_reverse_iterator = Base::const_reverse_iterator;
using iterator = Base::iterator;
using pointer = Base::pointer;
using reference = Base::reference;
using reverse_iterator = Base::reverse_iterator;
using value_type = Base::value_type;
using difference_type = U;
using size_type = U;
[[nodiscard]] constexpr const_reference at(size_type pos) const
{
return base::at(cast(pos));
return Base::at(cast(pos));
}
[[nodiscard]] constexpr reference at(size_type pos)
{
return base::at(cast(pos));
return Base::at(cast(pos));
}
[[nodiscard]] constexpr const_reference operator[](size_type pos) const
{
return base::operator[](cast(pos));
return Base::operator[](cast(pos));
}
[[nodiscard]] constexpr reference operator[](size_type pos)
{
return base::operator[](cast(pos));
return Base::operator[](cast(pos));
}
[[nodiscard]] constexpr size_type size() const noexcept
{
return cast(base::size());
return cast(Base::size());
}
[[nodiscard]] constexpr size_type max_size() const noexcept
{
return cast(base::max_size());
return cast(Base::max_size());
}
};
diff --git a/ include/based/container/list.hpp b/ include/based/container/list.hpp
@@ -16,34 +16,34 @@
class ListPool
{
public:
using value_type = T;
using list_type = N;
using ListType = N;
private:
struct NodeT
{
value_type value {};
list_type next;
ListType next;
};
std::vector<NodeT> m_pool{};
list_type m_free_list;
std::vector<NodeT> m_pool {};
ListType m_free_list;
[[nodiscard]] const NodeT& node(list_type x) const
[[nodiscard]] const NodeT& node(ListType x) const
{
assert(x != list_type(0));
return m_pool[(x - list_type(1)).value];
assert(x != ListType(0));
return m_pool[(x - ListType(1)).value];
}
[[nodiscard]] NodeT& node(list_type x)
[[nodiscard]] NodeT& node(ListType x)
{
assert(x != list_type(0));
return m_pool[(x - list_type(1)).value];
assert(x != ListType(0));
return m_pool[(x - ListType(1)).value];
}
[[nodiscard]] list_type new_node()
[[nodiscard]] ListType new_node()
{
m_pool.push_back(NodeT());
return list_type {static_cast<list_type::basic_type>(m_pool.size())};
return ListType {static_cast<ListType::basic_type>(m_pool.size())};
}
public:
@@ -52,22 +52,22 @@
public:
{
}
struct iterator
struct Iterator
{
using iterator_category = std::forward_iterator_tag;
using difference_type = ListPool::list_type;
using IteratorCategory = std::forward_iterator_tag;
using difference_type = ListPool::ListType;
using value_type = ListPool::value_type;
using reference = value_type&;
using pointer = value_type*;
iterator() = default;
Iterator() = default;
explicit iterator(ListPool& pool)
: iterator(pool, pool.node_empty())
explicit Iterator(ListPool& pool)
: Iterator(pool, pool.node_empty())
{
}
iterator(ListPool& pool, ListPool::list_type node)
Iterator(ListPool& pool, ListPool::ListType node)
: m_pool(&pool)
, m_node(node)
{
@@ -76,51 +76,51 @@
public:
reference operator*() const { return m_pool->value(m_node); }
pointer operator->() const { return &**this; }
iterator& operator++()
Iterator& operator++()
{
m_node = m_pool->next(m_node);
return *this;
}
iterator operator++(int)
Iterator operator++(int)
{
iterator tmp(*this);
Iterator tmp(*this);
++*this;
return tmp;
}
friend bool operator==(const iterator& x, const iterator& y)
friend bool operator==(const Iterator& x, const Iterator& y)
{
assert(x.m_pool == y.m_pool);
return x.m_node == y.m_node;
}
friend bool operator!=(const iterator& x, const iterator& y)
friend bool operator!=(const Iterator& x, const Iterator& y)
{
return !(x == y);
}
private:
ListPool* m_pool;
ListPool::list_type m_node;
ListPool::ListType m_node;
};
struct const_iterator
struct ConstIterator
{
using iterator_category = std::forward_iterator_tag;
using difference_type = ListPool::list_type;
using IteratorCategory = std::forward_iterator_tag;
using difference_type = ListPool::ListType;
using value_type = ListPool::value_type;
using reference = const value_type&;
using pointer = const value_type*;
const_iterator() = default;
ConstIterator() = default;
explicit const_iterator(const ListPool& pool)
: const_iterator(pool, pool.node_empty())
explicit ConstIterator(const ListPool& pool)
: ConstIterator(pool, pool.node_empty())
{
}
const_iterator(const ListPool& pool, ListPool::list_type node)
ConstIterator(const ListPool& pool, ListPool::ListType node)
: m_pool(&pool)
, m_node(node)
{
@@ -129,76 +129,73 @@
public:
reference operator*() const { return m_pool->value(m_node); }
pointer operator->() const { return &**this; }
const_iterator& operator++()
ConstIterator& operator++()
{
m_node = m_pool->next(m_node);
return *this;
}
const_iterator operator++(int)
ConstIterator operator++(int)
{
const_iterator tmp(*this);
ConstIterator tmp(*this);
++*this;
return tmp;
}
friend bool operator==(const const_iterator& x, const const_iterator& y)
friend bool operator==(const ConstIterator& x, const ConstIterator& y)
{
assert(x.m_pool == y.m_pool);
return x.m_node == y.m_node;
}
friend bool operator!=(const const_iterator& x, const const_iterator& y)
friend bool operator!=(const ConstIterator& x, const ConstIterator& y)
{
return !(x == y);
}
private:
const ListPool* m_pool;
ListPool::list_type m_node;
ListPool::ListType m_node;
};
[[nodiscard]] bool is_empty(list_type x) const { return x == node_empty(); }
[[nodiscard]] list_type node_empty() const { return list_type(0); }
[[nodiscard]] bool is_empty(ListType x) const { return x == node_empty(); }
[[nodiscard]] ListType node_empty() const { return ListType(0); }
[[nodiscard]] const value_type& value(list_type x) const
[[nodiscard]] const value_type& value(ListType x) const
{
return node(x).value;
}
[[nodiscard]] value_type& value(list_type x) { return node(x).value; }
[[nodiscard]] value_type& value(ListType x) { return node(x).value; }
[[nodiscard]] const list_type& next(list_type x) const
{
return node(x).next;
}
[[nodiscard]] list_type& next(list_type x) { return node(x).next; }
[[nodiscard]] const ListType& next(ListType x) const { return node(x).next; }
[[nodiscard]] ListType& next(ListType x) { return node(x).next; }
list_type free(list_type x)
ListType free(ListType x)
{
const list_type ret = next(x);
const ListType ret = next(x);
next(x) = m_free_list;
m_free_list = x;
return ret;
}
list_type free(
list_type front, // NOLINT(*swappable*)
list_type back
ListType free(
ListType front, // NOLINT(*swappable*)
ListType back
)
{
if (is_empty(front)) {
return node_empty();
}
const list_type ret = next(back);
const ListType ret = next(back);
next(back) = m_free_list;
m_free_list = front;
return ret;
}
[[nodiscard]] list_type allocate(const value_type& val, list_type tail)
[[nodiscard]] ListType allocate(const value_type& val, ListType tail)
{
list_type new_list = m_free_list;
ListType new_list = m_free_list;
if (is_empty(new_list)) {
new_list = new_node();
@@ -211,15 +208,15 @@
public:
return new_list;
}
using queue_t = std::pair<list_type, list_type>;
using QueueT = std::pair<ListType, ListType>;
[[nodiscard]] bool is_empty(const queue_t& queue) const
[[nodiscard]] bool is_empty(const QueueT& queue) const
{
return is_empty(queue.first);
}
[[nodiscard]] queue_t queue_empty() { return {node_empty(), node_empty()}; }
[[nodiscard]] QueueT queue_empty() { return {node_empty(), node_empty()}; }
[[nodiscard]] queue_t push_front(const queue_t& queue, const value_type& val)
[[nodiscard]] QueueT push_front(const QueueT& queue, const value_type& val)
{
auto new_node = allocate(val, queue.first);
if (is_empty(queue)) {
@@ -228,7 +225,7 @@
public:
return {new_node, queue.second};
}
[[nodiscard]] queue_t push_back(const queue_t& queue, const value_type& val)
[[nodiscard]] QueueT push_back(const QueueT& queue, const value_type& val)
{
auto new_node = allocate(val, node_empty());
if (is_empty(queue)) {
@@ -238,21 +235,21 @@
public:
return {queue.first, new_node};
}
[[nodiscard]] queue_t pop_front(const queue_t& queue)
[[nodiscard]] QueueT pop_front(const QueueT& queue)
{
if (is_empty(queue)) {
return queue;
}
queue_t ret = {next(queue.first), queue.second};
QueueT ret = {next(queue.first), queue.second};
free(queue.first);
return ret;
}
void free(const queue_t& queue) { free(queue.first, queue.second); }
void free(const QueueT& queue) { free(queue.first, queue.second); }
};
template<typename T, typename N>
void free_list(ListPool<T, N>& pool, typename ListPool<T, N>::list_type x)
void free_list(ListPool<T, N>& pool, typename ListPool<T, N>::ListType x)
{
while (!pool.is_empty(x)) {
x = pool.free(x);
diff --git a/ include/based/container/vector.hpp b/ include/based/container/vector.hpp
@@ -8,70 +8,70 @@
namespace based
template<class T, class U, class Allocator = std::allocator<T>>
class Vector : public std::vector<T, Allocator>
{
using base = std::vector<T, Allocator>;
using Base = std::vector<T, Allocator>;
static constexpr auto cast(U pos)
{
return static_cast<base::size_type>(pos.value);
return static_cast<Base::size_type>(pos.value);
}
static constexpr auto cast(base::size_type pos)
static constexpr auto cast(Base::size_type pos)
{
return static_cast<U>(pos);
}
public:
using allocator_type = Allocator;
using const_iterator = base::const_iterator;
using const_pointer = base::const_pointer;
using const_reference = base::const_reference;
using const_reverse_iterator = base::const_reverse_iterator;
using iterator = base::iterator;
using pointer = base::pointer;
using reference = base::reference;
using reverse_iterator = base::reverse_iterator;
using value_type = base::value_type;
using AllocatorType = Allocator;
using const_iterator = Base::const_iterator;
using const_pointer = Base::const_pointer;
using const_reference = Base::const_reference;
using const_reverse_iterator = Base::const_reverse_iterator;
using iterator = Base::iterator;
using pointer = Base::pointer;
using reference = Base::reference;
using reverse_iterator = Base::reverse_iterator;
using value_type = Base::value_type;
using difference_type = U;
using size_type = U;
[[nodiscard]] constexpr const_reference at(size_type pos) const
{
return base::at(cast(pos));
return Base::at(cast(pos));
}
[[nodiscard]] constexpr reference at(size_type pos)
{
return base::at(cast(pos));
return Base::at(cast(pos));
}
[[nodiscard]] constexpr const_reference operator[](size_type pos) const
{
return base::operator[](cast(pos));
return Base::operator[](cast(pos));
}
[[nodiscard]] constexpr reference operator[](size_type pos)
{
return base::operator[](cast(pos));
return Base::operator[](cast(pos));
}
[[nodiscard]] constexpr size_type size() const noexcept
{
return cast(base::size());
return cast(Base::size());
}
[[nodiscard]] constexpr size_type max_size() const noexcept
{
return cast(base::max_size());
return cast(Base::max_size());
}
constexpr void reserve(size_type new_cap) { base::reserve(cast(new_cap)); }
constexpr void capacity(size_type new_cap) { base::capacity(cast(new_cap)); }
constexpr void reserve(size_type new_cap) { Base::reserve(cast(new_cap)); }
constexpr void capacity(size_type new_cap) { Base::capacity(cast(new_cap)); }
constexpr void resize(size_type new_cap) { base::resize(cast(new_cap)); }
constexpr void resize(size_type new_cap) { Base::resize(cast(new_cap)); }
constexpr void resize(size_type new_cap, const value_type& value)
{
base::resize(cast(new_cap, value));
Base::resize(cast(new_cap, value));
}
};
diff --git a/ include/based/enum/enum.hpp b/ include/based/enum/enum.hpp
@@ -131,13 +131,13 @@
template<class Enum>
concept HasValueType = requires { typename Traits<Enum>::value_type; };
template<HasCategory Enum>
using category_type = typename Traits<Enum>::category;
using CategoryType = typename Traits<Enum>::category;
template<HasValueType Enum>
using value_type = typename Traits<Enum>::value_type;
template<HasValueType Enum>
using basic_type = typename Traits<Enum>::value_type::basic_type;
using BasicType = typename Traits<Enum>::value_type::basic_type;
template<class Enum>
concept HasNone = requires {
@@ -172,7 +172,7 @@
static constexpr Enum max = Enum::max;
template<class Enum, class Category>
concept IsCategory = requires {
requires(HasCategory<Enum>);
requires(SameAs<Category, category_type<Enum>>);
requires(SameAs<Category, CategoryType<Enum>>);
};
template<class Enum>
@@ -227,7 +227,7 @@
template<class Enum>
constexpr enum_traits::value_type<Enum> value_cast_impl(Enum value) noexcept
{
return static_cast<enum_traits::value_type<Enum>>(
static_cast<enum_traits::basic_type<Enum>>(value)
static_cast<enum_traits::BasicType<Enum>>(value)
);
}
@@ -235,7 +235,7 @@
template<class Enum>
constexpr Enum enum_cast_impl(enum_traits::value_type<Enum> value) noexcept
{
// NOLINTNEXTLINE(*EnumCastOutOfRange*)
return static_cast<Enum>(static_cast<enum_traits::basic_type<Enum>>(value));
return static_cast<Enum>(static_cast<enum_traits::BasicType<Enum>>(value));
}
} // namespace detail
@@ -260,15 +260,15 @@
struct Traits;
template<>
struct Traits<category::Def>
{
using category = category::Def;
using Category = category::Def;
template<enum_traits::IsCategory<category> Enum>
template<enum_traits::IsCategory<Category> Enum>
static constexpr bool valid() noexcept
{
return true;
}
template<enum_traits::IsCategory<category> Enum>
template<enum_traits::IsCategory<Category> Enum>
static constexpr Enum enum_cast(enum_traits::value_type<Enum> value) noexcept
{
return static_cast<Enum>(value);
@@ -278,9 +278,9 @@
struct Traits<category::Def>
template<>
struct Traits<category::Standard>
{
using category = category::Standard;
using Category = category::Standard;
template<enum_traits::IsCategory<category> Enum>
template<enum_traits::IsCategory<Category> Enum>
static constexpr bool valid() noexcept
{
if constexpr (enum_traits::HasNone<Enum>) {
@@ -293,7 +293,7 @@
struct Traits<category::Standard>
return false;
}
template<enum_traits::IsCategory<category> Enum>
template<enum_traits::IsCategory<Category> Enum>
static constexpr Enum enum_cast(enum_traits::value_type<Enum> value) noexcept
{
constexpr auto xnone = detail::value_cast_impl(enum_traits::none<Enum>);
@@ -308,9 +308,9 @@
struct Traits<category::Standard>
template<>
struct Traits<category::Linear>
{
using category = category::Linear;
using Category = category::Linear;
template<enum_traits::IsCategory<category> Enum>
template<enum_traits::IsCategory<Category> Enum>
static constexpr bool valid() noexcept
{
if constexpr (enum_traits::HasNone<Enum>) {
@@ -323,7 +323,7 @@
struct Traits<category::Linear>
}
}
template<enum_traits::IsCategory<category> Enum>
template<enum_traits::IsCategory<Category> Enum>
static constexpr Enum enum_cast(enum_traits::value_type<Enum> x) noexcept
{
constexpr auto xnone = detail::value_cast_impl(enum_traits::none<Enum>);
@@ -338,9 +338,9 @@
struct Traits<category::Linear>
template<>
struct Traits<category::Bitmask>
{
using category = category::Bitmask;
using Category = category::Bitmask;
template<enum_traits::IsCategory<category> Enum>
template<enum_traits::IsCategory<Category> Enum>
static constexpr bool valid() noexcept
{
constexpr auto xmin = detail::value_cast_impl(enum_traits::min<Enum>);
@@ -357,7 +357,7 @@
struct Traits<category::Bitmask>
return false;
}
template<enum_traits::IsCategory<category> Enum>
template<enum_traits::IsCategory<Category> Enum>
static constexpr Enum enum_cast(enum_traits::value_type<Enum> value) noexcept
{
constexpr auto xmin = detail::value_cast_impl(enum_traits::min<Enum>);
@@ -381,9 +381,9 @@
struct Traits<category::Bitmask>
template<class Enum, Enum... vals>
struct Traits<category::Discrete<Enum, vals...>>
{
using category = category::Discrete<Enum, vals...>;
using Category = category::Discrete<Enum, vals...>;
template<enum_traits::IsCategory<category> EnumI>
template<enum_traits::IsCategory<Category> EnumI>
requires SameAs<Enum, EnumI>
static constexpr bool valid() noexcept
{
@@ -394,7 +394,7 @@
struct Traits<category::Discrete<Enum, vals...>>
}
}
template<enum_traits::IsCategory<category> EnumI>
template<enum_traits::IsCategory<Category> EnumI>
requires SameAs<Enum, EnumI>
static constexpr Enum enum_cast(enum_traits::value_type<Enum> value) noexcept
{
@@ -408,14 +408,13 @@
struct Traits<category::Discrete<Enum, vals...>>
template<class Enum>
static constexpr auto valid() noexcept
{
return Traits<enum_traits::category_type<Enum>>::template valid<Enum>();
return Traits<enum_traits::CategoryType<Enum>>::template valid<Enum>();
}
template<class Enum>
static constexpr auto enum_cast(enum_traits::value_type<Enum> value) noexcept
{
return Traits<enum_traits::category_type<Enum>>::template enum_cast<Enum>(
value
return Traits<enum_traits::CategoryType<Enum>>::template enum_cast<Enum>(value
);
}
diff --git a/ include/based/functional/function.hpp b/ include/based/functional/function.hpp
@@ -3,8 +3,9 @@
#include <functional>
#include "based/concept/is/same.hpp"
#include "based/trait/signature.hpp"
#include "based/integral/types.hpp"
#include "based/trait/decay.hpp"
#include "based/trait/signature.hpp"
#include "based/utility/buffer.hpp"
#include "based/utility/forward.hpp"
@@ -15,48 +16,50 @@
namespace based
template<
typename Signature,
size_t size = sizeof(void*),
size_t alignment = alignof(void*)>
class function;
SizeT size = sizeof(void*),
SizeT alignment = alignof(void*)>
class Function;
template<size_t size, size_t alignment, typename Ret, typename... Args>
class function<Ret(Args...), size, alignment>
template<SizeT size, SizeT alignment, typename Ret, typename... Args>
class Function<Ret(Args...), size, alignment>
{
Buffer<size, alignment> m_space{};
Buffer<size, alignment> m_space {};
using executor_t = Ret (*)(Args..., void*);
using ExecutorT = Ret (*)(Args..., void*);
static constexpr Ret default_executor(Args... /* args */, void* /* func */)
{
throw std::bad_function_call();
}
constexpr static executor_t m_default_executor = default_executor;
executor_t m_executor = m_default_executor;
constexpr static ExecutorT m_default_executor = default_executor;
ExecutorT m_executor = m_default_executor;
template<typename Callable>
static Ret executor(Args... args, void* func)
{
return std::invoke(
*static_cast<function*>(func)->m_space.template as<Callable>(),
*static_cast<Function*>(func)->m_space.template as<Callable>(),
based::forward<Args>(args)...
);
}
public:
function() = default;
Function() = default;
template<typename CallableArg, typename Callable = std::decay_t<CallableArg>>
template<typename CallableArg, typename Callable = DecayT<CallableArg>>
requires(requires {
!SameAs<function, Callable>;
!SameAs<Function, Callable>;
sizeof(Callable) <= size;
alignof(Callable) <= alignment;
std::is_trivially_destructible_v<Callable>;
std::is_trivially_copyable_v<Callable>;
})
function(CallableArg&& callable) // NOLINT(*explicit*)
: m_space(std::in_place_type<Callable>, based::forward<CallableArg>(callable))
Function(CallableArg&& callable) // NOLINT(*explicit*)
: m_space(
std::in_place_type<Callable>, based::forward<CallableArg>(callable)
)
, m_executor(executor<Callable>)
{
}
@@ -66,15 +69,15 @@
public:
{
return this->m_executor(
based::forward<CallArgs>(callargs)...,
const_cast<function*>(this) // NOLINT(*const-cast*)
const_cast<Function*>(this) // NOLINT(*const-cast*)
);
}
};
template<typename Ret, typename... Args>
function(Ret (*)(Args...)) -> function<Ret(Args...)>;
Function(Ret (*)(Args...)) -> Function<Ret(Args...)>;
template<typename F, typename Sig = signature_t<F, decltype(&F::operator())>>
function(F) -> function<Sig>;
template<typename F, typename Sig = SignatureT<F, decltype(&F::operator())>>
Function(F) -> Function<Sig>;
} // namespace based
diff --git a/ include/based/functional/invoke.hpp b/ include/based/functional/invoke.hpp
@@ -17,22 +17,24 @@
constexpr decltype(auto) invoke_memptr(
Pointed C::* member, Object&& object, Args&&... args
)
{
using object_t = remove_cvref_t<Object>;
using ObjectT = RemoveCvrefT<Object>;
constexpr bool is_member_function = is_function_v<Pointed>;
constexpr bool is_wrapped = false = is_reference_wrapper_v<object_t>;
constexpr bool is_wrapped = false = is_reference_wrapper_v<ObjectT>;
constexpr bool is_derived_object = false =
is_same_v<C, object_t> || is_base_of_v<C, object_t>;
is_same_v<C, ObjectT> || is_base_of_v<C, ObjectT>;
if constexpr (is_member_function) {
if constexpr (is_derived_object) {
return (based::forward<Object>(object).*member)(based::forward<Args>(args)...);
return (based::forward<Object>(object).*member)(based::forward<Args>(args
)...);
}
if constexpr (is_wrapped) {
return (object.get().*member)(based::forward<Args>(args)...);
}
return ((*based::forward<Object>(object)).*member)(based::forward<Args>(args)...);
return ((*based::forward<Object>(object)).*member)(based::forward<Args>(args
)...);
} else {
static_assert(is_object_v<Pointed> && sizeof...(args) == 0);
if constexpr (is_derived_object) {
@@ -53,7 +55,7 @@
constexpr decltype(auto) invoke(
F&& func, Args&&... args
) noexcept(is_nothrow_invocable_v<F, Args...>)
{
if constexpr (is_member_pointer_v<remove_cvref_t<F>>) {
if constexpr (is_member_pointer_v<RemoveCvrefT<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
@@ -26,13 +26,13 @@
class ReferenceWrapper
{
public:
// types
using type = T;
using Type = T;
// construct/copy/destroy
template<class U>
requires(requires {
detail::fun<T>(declval<U>());
requires(!is_same_v<ReferenceWrapper, remove_cvref_t<U>>);
requires(!is_same_v<ReferenceWrapper, RemoveCvrefT<U>>);
})
// NOLINTNEXTLINE(*explicit*)
diff --git a/ include/based/instrumentation/instrumented.hpp b/ include/based/instrumentation/instrumented.hpp
@@ -35,7 +35,7 @@
struct InstrumentedBase
static op::enum_type::array<double> counts;
static void initialize(size_t size)
static void initialize(SizeT size)
{
std::fill(std::begin(counts), std::end(counts), 0.0);
std::count[op::n] = static_cast<double>(size);
@@ -43,7 +43,7 @@
struct InstrumentedBase
};
BASED_DEFINE_ENUM_CLASS(
instrumented_base,
InstrumentedBase,
op,
u8,
0,
@@ -193,19 +193,19 @@
inline auto normalize_nlogn1(double x, double n)
template<typename Function>
void count_operations(
size_t first,
size_t last,
SizeT first,
SizeT last,
Function fun,
double (*norm)(double, double) = dont_normalize
)
{
using instrumented = instrumented<double>;
using esize_t = instrumented::op::enum_type::size_type;
using eSizeT = instrumented::op::enum_type::SizeType;
constexpr esize_t cols = instrumented::op::enum_type::size;
const esize_t decimals((norm == dont_normalize) ? 0 : 2);
constexpr eSizeT cols = instrumented::op::enum_type::size;
const eSizeT decimals((norm == dont_normalize) ? 0 : 2);
instrumented_base::op::enum_type::array<double> values;
InstrumentedBase::op::enum_type::array<double> values;
static constexpr int width = 12;
table const tbl(width);
@@ -226,7 +226,7 @@
void count_operations(
const auto dbl = static_cast<double>(first);
values[instrumented_base::op::n] = dbl;
for (esize_t k = 1; k < cols; ++k) {
for (eSizeT k = 1; k < cols; ++k) {
const auto& val = instrumented::op::enum_type::get(k);
values[val] = norm(instrumented::counts[val], dbl);
}
diff --git a/ include/based/instrumentation/registry.hpp b/ include/based/instrumentation/registry.hpp
@@ -9,7 +9,7 @@
template<typename D>
class Registry
{
public:
static size_t count;
static SizeT count;
static D* head;
D* prev;
D* next;
@@ -54,7 +54,7 @@
private:
};
template<typename D>
size_t Registry<D>::count(0);
SizeT Registry<D>::count(0);
template<typename D>
D* Registry<D>::head(nullptr);
diff --git a/ include/based/instrumentation/table.hpp b/ include/based/instrumentation/table.hpp
@@ -11,7 +11,7 @@
namespace based
class Table
{
public:
explicit Table(size_t min_wth)
explicit Table(SizeT min_wth)
: m_min_wth(min_wth)
{
}
@@ -27,7 +27,7 @@
public:
}
template<typename I>
void print_row(I first, I last, size_t precision)
void print_row(I first, I last, SizeT precision)
{
std::cout << std::format("{:{}} | ", *first++, m_min_wth);
while (first != last) {
@@ -38,7 +38,7 @@
public:
}
private:
size_t m_min_wth;
SizeT m_min_wth;
};
} // namespace based
diff --git a/ include/based/instrumentation/timer.hpp b/ include/based/instrumentation/timer.hpp
@@ -10,11 +10,11 @@
namespace based
class Timer
{
public:
using clock_t = std::chrono::high_resolution_clock;
using duration_t = std::chrono::microseconds;
using ClockT = std::chrono::high_resolution_clock;
using DurationT = std::chrono::microseconds;
Timer()
: m_startp(clock_t::now())
: m_startp(ClockT::now())
{
}
@@ -33,12 +33,12 @@
public:
{
static const auto count = [](const auto& time)
{
return std::chrono::time_point_cast<duration_t>(time)
return std::chrono::time_point_cast<DurationT>(time)
.time_since_epoch()
.count();
};
const auto endp = clock_t::now();
const auto endp = ClockT::now();
const auto start = count(m_startp);
const auto end = count(endp);
@@ -50,7 +50,7 @@
public:
}
private:
std::chrono::time_point<clock_t> m_startp;
std::chrono::time_point<ClockT> m_startp;
};
} // namespace based
diff --git a/ include/based/integral/strong.hpp b/ include/based/integral/strong.hpp
@@ -20,8 +20,8 @@
template<class V, class Tag>
struct StrongType
{
using value_type = StrongType;
using basic_type = V;
using tag_type = Tag;
using basic_type = V; // NOLINT(*identifier*)
using tag_type = Tag; // NOLINT(*identifier*)
basic_type value;
diff --git a/ include/based/integral/types.hpp b/ include/based/integral/types.hpp
@@ -1,15 +1,15 @@
#pragma once
#include "based/utility/assert.hpp"
#include "based/macro/foreach_1.hpp"
#include "based/integral/strong.hpp"
#include "based/macro/foreach_1.hpp"
#include "based/utility/assert.hpp"
namespace based
{
// NOLINTBEGIN(google-runtime-int)
using size_t = unsigned long long int;
using SizeT = unsigned long long int;
#define BASED_DETAIL_OP_UNARY(Prefix, Name, Index) \
auto Name(Prefix##8)->Prefix##8; \
diff --git a/ include/based/memory/nullptr.hpp b/ include/based/memory/nullptr.hpp
@@ -3,6 +3,6 @@
namespace based
{
using nullptr_t = decltype(nullptr);
using NullptrT = decltype(nullptr);
} // namespace based
diff --git a/ include/based/string/literal.hpp b/ include/based/string/literal.hpp
@@ -7,7 +7,7 @@
namespace based
{
template<size_t n>
template<std::size_t n>
struct StringLiteral
{
// NOLINTNEXTLINE(*explicit*, *array*)
@@ -22,7 +22,7 @@
struct StringLiteral
return {data(), size()};
}
[[nodiscard]] constexpr size_t size() const { return n - 1; }
[[nodiscard]] constexpr std::size_t size() const { return n - 1; }
[[nodiscard]] constexpr const char* data() const { return m_value.data(); }
std::array<char, n> m_value;
diff --git a/ include/based/trait/add/lvalue_reference.hpp b/ include/based/trait/add/lvalue_reference.hpp
@@ -11,16 +11,16 @@
namespace detail
{
// Note that “cv void&” is a substitution failure
template<class T> auto try_add(int) -> type_identity<T&>;
template<class T> auto try_add(int) -> TypeIdentity<T&>;
// Handle T = cv void case
template<class T> auto try_add(...) -> type_identity<T>;
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 add_lvalue_reference_t = AddLvalueReference<T>::type;
template<class T> using AddLvalueReferenceT = AddLvalueReference<T>::Type;
// clang-format on
diff --git a/ include/based/trait/add/pointer.hpp b/ include/based/trait/add/pointer.hpp
@@ -11,14 +11,14 @@
namespace based
namespace detail
{
template<class T> TypeIdentity<remove_reference_t<T>*> try_add_pointer(int);
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 add_pointer_t = AddPointer<T>::type;
template<class T> using AddPointerT = AddPointer<T>::Type;
// clang-format on
diff --git a/ include/based/trait/add/rvalue_reference.hpp b/ include/based/trait/add/rvalue_reference.hpp
@@ -11,16 +11,16 @@
namespace detail
{
// Note that “cv void&&” is a substitution failure
template<class T> auto try_add(int) -> std::type_identity<T&&>;
template<class T> auto try_add(int) -> TypeIdentity<T&&>;
// Handle T = cv void case
template<class T> auto try_add(...) -> std::type_identity<T>;
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 add_rvalue_reference_t = AddRvalueReference<T>::type;
template<class T> using AddRvalueReferenceT = AddRvalueReference<T>::Type;
// clang-format on
diff --git a/ include/based/trait/conditional.hpp b/ include/based/trait/conditional.hpp
@@ -5,10 +5,10 @@
namespace based
// 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; };
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; };
template<bool b, class T, class F> using conditional_t = Conditional<b, T, F>::type;
template<bool b, class T, class F> using ConditionalT = Conditional<b, T, F>::Type;
// clang-format on
diff --git a/ include/based/trait/decay.hpp b/ include/based/trait/decay.hpp
@@ -17,20 +17,20 @@
template<class T>
struct Decay
{
private:
using u = remove_reference_t<T>;
using U = RemoveReferenceT<T>;
public:
using type = conditional_t<
is_array_v<u>,
add_pointer_t<remove_extent_t<u>>,
conditional_t<
is_function_v<u>,
add_pointer_t<u>,
remove_cv_t<u>>
using Type = ConditionalT<
is_array_v<U>,
AddPointerT<RemoveExtentT<U>>,
ConditionalT<
is_function_v<U>,
AddPointerT<U>,
RemoveCvT<U>>
>;
};
template<class T> using decay_t = typename Decay<T>::type;
template<class T> using DecayT = typename Decay<T>::Type;
// clang-format on
diff --git a/ include/based/trait/enable_if.hpp b/ include/based/trait/enable_if.hpp
@@ -6,9 +6,9 @@
namespace based
// clang-format off
template<bool b, class T = void> struct EnableIf {};
template<class T> struct EnableIf<true, T> { using type = T; };
template<class T> struct EnableIf<true, T> { using Type = T; };
template<bool b, class T = void> using enable_if_t = typename EnableIf<b, T>::type;
template<bool b, class T = void> using EnableIfT = typename EnableIf<b, T>::type;
// clang-format on
diff --git a/ include/based/trait/integral_constant.hpp b/ include/based/trait/integral_constant.hpp
@@ -9,7 +9,7 @@
struct IntegralConstant
static constexpr T value = v;
using value_type = T;
using type = IntegralConstant;
using Type = IntegralConstant;
// NOLINTNEXTLINE(*explicit*)
constexpr operator value_type() const noexcept { return value; }
@@ -17,9 +17,9 @@
struct IntegralConstant
};
template<bool b>
using bool_constant = IntegralConstant<bool, b>;
using BoolConstant = IntegralConstant<bool, b>;
using true_type = bool_constant<true>;
using false_type = bool_constant<false>;
using TrueType = BoolConstant<true>;
using FalseType = BoolConstant<false>;
} // namespace based
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, decay_t<T>>)
requires(is_base_of_v<B, DecayT<T>>)
static auto get(T&& obj) -> T&&;
template<class T>
requires(is_reference_wrapper_v<decay_t<T>>)
requires(is_reference_wrapper_v<DecayT<T>>)
static auto get(T&& obj) -> decltype(obj.get());
template<class T>
requires(!is_base_of_v<B, decay_t<T>> && !is_reference_wrapper_v<decay_t<T>>)
requires(!is_base_of_v<B, DecayT<T>> && !is_reference_wrapper_v<DecayT<T>>)
static auto get(T&& obj) -> decltype(*based::forward<T>(obj));
template<class T, class... Args, class MT1>
@@ -47,10 +47,9 @@
struct InvokeImpl<MT B::*>
};
template<class F, class... Args>
auto invoke_f(F&& func, Args&&... args)
-> decltype(InvokeImpl<decay_t<F>>::call(
based::forward<F>(func), based::forward<Args>(args)...
));
auto invoke_f(F&& func, Args&&... args) -> decltype(InvokeImpl<DecayT<F>>::call(
based::forward<F>(func), based::forward<Args>(args)...
));
} // namespace detail
@@ -68,7 +67,7 @@
struct InvokeResult<
F,
Args...>
{
using type = decltype(detail::invoke_f(declval<F>(), declval<Args>()...));
using Type = decltype(detail::invoke_f(declval<F>(), declval<Args>()...));
};
} // namespace detail
@@ -79,6 +78,6 @@
struct InvokeResult : detail::InvokeResult<void, F, Args...>
};
template<class F, class... Args>
using invoke_result_t = typename InvokeResult<F, Args...>::type;
using InvokeResultT = typename InvokeResult<F, Args...>::Type;
} // namespace based
diff --git a/ include/based/trait/is/arithmetic.hpp b/ include/based/trait/is/arithmetic.hpp
@@ -8,7 +8,7 @@
namespace based
{
template<class T>
struct IsArithmetic : bool_constant<is_integral_v<T> || is_floating_point_v<T>>
struct IsArithmetic : BoolConstant<is_integral_v<T> || is_floating_point_v<T>>
{
};
diff --git a/ include/based/trait/is/array.hpp b/ include/based/trait/is/array.hpp
@@ -1,24 +1,24 @@
#pragma once
#include "based/trait/integral_constant.hpp"
#include "based/integral/types.hpp"
#include "based/trait/integral_constant.hpp"
namespace based
{
// NOLINTBEGIN(*array*)
template<class T>
struct IsArray : false_type
struct IsArray : FalseType
{
};
template<class T>
struct IsArray<T[]> : true_type
struct IsArray<T[]> : TrueType
{
};
template<class T, size_t n>
struct IsArray<T[n]> : true_type
template<class T, SizeT n>
struct IsArray<T[n]> : TrueType
{
};
// NOLINTEND(*array*)
diff --git a/ include/based/trait/is/base_of.hpp b/ include/based/trait/is/base_of.hpp
@@ -10,22 +10,22 @@
namespace details
{
template<class B>
true_type test_ptr_conv(const volatile B*);
TrueType test_ptr_conv(const volatile B*);
template<class>
false_type test_ptr_conv(const volatile void*);
FalseType test_ptr_conv(const volatile void*);
template<class B, class D>
auto test_is_base_of(int)
-> decltype(test_ptr_conv<B>(static_cast<D*>(nullptr)));
template<class, class>
auto test_is_base_of(...) -> true_type; // private or ambiguous base
auto test_is_base_of(...) -> TrueType; // private or ambiguous base
} // namespace details
template<class Base, class Derived>
struct IsBaseOf : false_type
struct IsBaseOf : FalseType
{
};
@@ -34,7 +34,7 @@
template<class Base, class Derived>
is_class_v<Base> && is_class_v<Derived>
&& decltype(details::test_is_base_of<Base, Derived>(0))::value
)
struct IsBaseOf<Base, Derived> : true_type
struct IsBaseOf<Base, Derived> : TrueType
{
};
diff --git a/ include/based/trait/is/class.hpp b/ include/based/trait/is/class.hpp
@@ -10,10 +10,10 @@
namespace detail
{
template<class T>
bool_constant<!is_union_v<T>> test(int T::*);
BoolConstant<!is_union_v<T>> test(int T::*);
template<class T>
false_type test(...);
FalseType test(...);
} // namespace detail
diff --git a/ include/based/trait/is/const.hpp b/ include/based/trait/is/const.hpp
@@ -6,12 +6,12 @@
namespace based
{
template<class T>
struct IsConst : false_type
struct IsConst : FalseType
{
};
template<class T>
struct IsConst<const T> : true_type
struct IsConst<const T> : TrueType
{
};
diff --git a/ include/based/trait/is/convertable.hpp b/ include/based/trait/is/convertable.hpp
@@ -6,7 +6,7 @@
namespace based
{
template<class From, class To>
using is_convertible = std::is_convertible<From, To>;
using IsConvertible = std::is_convertible<From, To>;
template<class From, class To>
constexpr bool is_convertible_v = std::is_convertible_v<From, To>;
diff --git a/ include/based/trait/is/enum.hpp b/ include/based/trait/is/enum.hpp
@@ -6,7 +6,7 @@
namespace based
{
template<class T>
using is_enum = std::is_enum<T>;
using is_enum = std::is_enum<T>; // NOLINT(*identifier*)
template<class T>
constexpr bool is_enum_v = std::is_enum_v<T>;
diff --git a/ include/based/trait/is/floating_point.hpp b/ include/based/trait/is/floating_point.hpp
@@ -8,13 +8,13 @@
namespace based
{
template<class T>
struct IsFloatingPoint : false_type
struct IsFloatingPoint : FalseType
{
};
template<class T>
requires(is_same_v<float, remove_cv_t<T>> || is_same_v<double, remove_cv_t<T>> || is_same_v<long double, remove_cv_t<T>>)
struct IsFloatingPoint<T> : true_type
requires(is_same_v<float, RemoveCvT<T>> || is_same_v<double, RemoveCvT<T>> || is_same_v<long double, RemoveCvT<T>>)
struct IsFloatingPoint<T> : TrueType
{
};
diff --git a/ include/based/trait/is/function.hpp b/ include/based/trait/is/function.hpp
@@ -8,81 +8,81 @@
namespace based
// clang-format off
template<typename>
struct IsFunction : false_type {};
struct IsFunction : FalseType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args...) noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args...) noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args...) & noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args...) & noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args...) && noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args...) && noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args...) const noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args...) const noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args...) const & noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args...) const & noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args...) const && noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args...) const && noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args...) volatile noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args...) volatile noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args...) volatile & noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args...) volatile & noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args...) volatile && noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args...) volatile && noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args...) const volatile noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args...) const volatile noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args...) const volatile & noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args...) const volatile & noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args...) const volatile && noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args...) const volatile && noexcept(ne)> : TrueType {};
// NOLINTBEGIN(*ambiguous-ellipsis*)
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args......) noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args......) noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args......) & noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args......) & noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args......) && noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args......) && noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args......) const noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args......) const noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args......) const & noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args......) const & noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args......) const && noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args......) const && noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args......) volatile noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args......) volatile noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args......) volatile & noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args......) volatile & noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args......) volatile && noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args......) volatile && noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args......) const volatile noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args......) const volatile noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args......) const volatile & noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args......) const volatile & noexcept(ne)> : TrueType {};
template<typename Ret, bool ne, typename... Args>
struct IsFunction<Ret(Args......) const volatile && noexcept(ne)> : true_type {};
struct IsFunction<Ret(Args......) const volatile && noexcept(ne)> : TrueType {};
// NOLINTEND(*ambiguous-ellipsis*)
diff --git a/ include/based/trait/is/integral.hpp b/ include/based/trait/is/integral.hpp
@@ -6,7 +6,7 @@
namespace based
{
template<class T>
struct IsIntegral : false_type
struct IsIntegral : FalseType
{
};
@@ -21,7 +21,7 @@
template<class T>
ptr + obj; // Exclude everything not yet excluded but integral types
}
)
struct IsIntegral<T> : true_type
struct IsIntegral<T> : TrueType
{
};
diff --git a/ include/based/trait/is/invocable.hpp b/ include/based/trait/is/invocable.hpp
@@ -6,13 +6,13 @@
namespace based
{
template<class F, class... Args>
using is_invocable = std::is_invocable<F, Args...>;
using IsInvocable = std::is_invocable<F, Args...>;
template<class F, class... Args>
constexpr bool is_invocable_v = std::is_invocable_v<F, Args...>;
template<class F, class... Args>
using is_nothrow_invocable = std::is_nothrow_invocable<F, Args...>;
using IsNothrowInvocable = std::is_nothrow_invocable<F, Args...>;
template<class F, class... Args>
constexpr bool is_nothrow_invocable_v = std::is_nothrow_invocable_v<F, Args...>;
diff --git a/ include/based/trait/is/lvalue_reference.hpp b/ include/based/trait/is/lvalue_reference.hpp
@@ -6,12 +6,12 @@
namespace based
{
template<class T>
struct IsLvalueReference : false_type
struct IsLvalueReference : FalseType
{
};
template<class T>
struct IsLvalueReference<T&> : true_type
struct IsLvalueReference<T&> : TrueType
{
};
diff --git a/ include/based/trait/is/member_pointer.hpp b/ include/based/trait/is/member_pointer.hpp
@@ -10,17 +10,19 @@
namespace detail
{
template<class T>
struct IsMemberPointerHelper : false_type { };
struct IsMemberPointerHelper : FalseType
{
};
template<class T, class U>
struct IsMemberPointerHelper<T U::*> : true_type
struct IsMemberPointerHelper<T U::*> : TrueType
{
};
} // namespace detail
template<class T>
struct IsMemberPointer : detail::IsMemberPointerHelper<remove_cv_t<T>>
struct IsMemberPointer : detail::IsMemberPointerHelper<RemoveCvT<T>>
{
};
diff --git a/ include/based/trait/is/null_pointer.hpp b/ include/based/trait/is/null_pointer.hpp
@@ -8,7 +8,7 @@
namespace based
{
template<class T>
struct IsNullPointer : IsSame<nullptr_t, remove_cv_t<T>>
struct IsNullPointer : IsSame<NullptrT, RemoveCvT<T>>
{
};
diff --git a/ include/based/trait/is/object.hpp b/ include/based/trait/is/object.hpp
@@ -10,13 +10,13 @@
namespace based
{
template<class T>
struct IsObject : false_type
struct IsObject : FalseType
{
};
template<class T>
requires(is_scalar_v<T> || is_array_v<T> || is_union_v<T> || is_class_v<T>)
struct IsObject<T> : true_type
struct IsObject<T> : TrueType
{
};
diff --git a/ include/based/trait/is/pointer.hpp b/ include/based/trait/is/pointer.hpp
@@ -6,27 +6,27 @@
namespace based
{
template<class T>
struct IsPointer : false_type
struct IsPointer : FalseType
{
};
template<class T>
struct IsPointer<T*> : true_type
struct IsPointer<T*> : TrueType
{
};
template<class T>
struct IsPointer<T* const> : true_type
struct IsPointer<T* const> : TrueType
{
};
template<class T>
struct IsPointer<T* volatile> : true_type
struct IsPointer<T* volatile> : TrueType
{
};
template<class T>
struct IsPointer<T* const volatile> : true_type
struct IsPointer<T* const volatile> : TrueType
{
};
diff --git a/ include/based/trait/is/reference_wrapper.hpp b/ include/based/trait/is/reference_wrapper.hpp
@@ -6,12 +6,12 @@
namespace based
{
template<class T>
struct IsReferenceWrapper : false_type
struct IsReferenceWrapper : FalseType
{
};
template<class U>
struct IsReferenceWrapper<ReferenceWrapper<U>> : true_type
struct IsReferenceWrapper<ReferenceWrapper<U>> : TrueType
{
};
diff --git a/ include/based/trait/is/rvalue_reference.hpp b/ include/based/trait/is/rvalue_reference.hpp
@@ -6,12 +6,12 @@
namespace based
{
template<class T>
struct IsRvalueReference : false_type
struct IsRvalueReference : FalseType
{
};
template<class T>
struct IsRvalueReference<T&&> : true_type
struct IsRvalueReference<T&&> : TrueType
{
};
diff --git a/ include/based/trait/is/same.hpp b/ include/based/trait/is/same.hpp
@@ -6,12 +6,12 @@
namespace based
{
template<class T, class U>
struct IsSame : false_type
struct IsSame : FalseType
{
};
template<class T>
struct IsSame<T, T> : true_type
struct IsSame<T, T> : TrueType
{
};
diff --git a/ include/based/trait/is/scalar.hpp b/ include/based/trait/is/scalar.hpp
@@ -11,7 +11,7 @@
namespace based
{
template<class T>
struct IsScalar : false_type
struct IsScalar : FalseType
{
};
diff --git a/ include/based/trait/is/union.hpp b/ include/based/trait/is/union.hpp
@@ -6,7 +6,7 @@
namespace based
{
template<class T>
using is_union = std::is_union<T>;
using IsUnion = std::is_union<T>;
template<class T>
constexpr bool is_union_v = std::is_union_v<T>;
diff --git a/ include/based/trait/is/void.hpp b/ include/based/trait/is/void.hpp
@@ -7,7 +7,7 @@
namespace based
{
template<class T>
struct IsVoid : IsSame<void, remove_cv_t<T>>
struct IsVoid : IsSame<void, RemoveCvT<T>>
{
};
diff --git a/ include/based/trait/iterator.hpp b/ include/based/trait/iterator.hpp
@@ -14,8 +14,8 @@
struct IteratorTraits
{
using value_type = I;
using distance_type = u64;
using pointer_type = I&;
using reference_type = I*;
using PointerType = I&;
using ReferenceType = I*;
};
template<typename I>
@@ -23,23 +23,23 @@
template<typename I>
struct IteratorTraits<I>
{
using value_type = std::iterator_traits<I>::value_type;
using distance_type = std::iterator_traits<I>::difference_type;
using pointer_type = std::iterator_traits<I>::pointer;
using reference_type = std::iterator_traits<I>::reference;
using DistanceType = std::iterator_traits<I>::difference_type;
using PointerType = std::iterator_traits<I>::pointer;
using ReferenceType = std::iterator_traits<I>::reference;
};
} // namespace detail
template<typename T>
using iter_value_t = detail::IteratorTraits<T>::value_type;
using IterValueT = detail::IteratorTraits<T>::value_type;
template<typename T>
using iter_dist_t = detail::IteratorTraits<T>::distance_type;
using IterDistT = detail::IteratorTraits<T>::distance_type;
template<typename T>
using iter_ptr_t = detail::IteratorTraits<T>::pointer;
using IterPtrT = detail::IteratorTraits<T>::pointer;
template<typename T>
using iter_ref_t = detail::IteratorTraits<T>::reference;
using IterRefT = detail::IteratorTraits<T>::reference;
} // namespace based
diff --git a/ include/based/trait/remove/const.hpp b/ include/based/trait/remove/const.hpp
@@ -5,10 +5,10 @@
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> struct RemoveConst { using Type = T; };
template<class T> struct RemoveConst<const T> { using Type = T; };
template<class T> using remove_const_t = typename RemoveConst<T>::type;
template<class T> using RemoveConstT = typename RemoveConst<T>::Type;
// clang-format on
diff --git a/ include/based/trait/remove/cv.hpp b/ include/based/trait/remove/cv.hpp
@@ -5,12 +5,12 @@
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> 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 remove_cv_t = typename RemoveCv<T>::type;
template<class T> using RemoveCvT = typename RemoveCv<T>::Type;
// clang-format on
diff --git a/ include/based/trait/remove/cvref.hpp b/ include/based/trait/remove/cvref.hpp
@@ -9,10 +9,10 @@
namespace based
// clang-format off
template<class T> struct RemoveCvref {
using type = remove_cv_t<remove_reference_t<T>>;
using Type = RemoveCvT<RemoveReferenceT<T>>;
};
template<class T> using remove_cvref_t = typename RemoveCvref<T>::type;
template<class T> using RemoveCvrefT = typename RemoveCvref<T>::Type;
// clang-format on
diff --git a/ include/based/trait/remove/extent.hpp b/ include/based/trait/remove/extent.hpp
@@ -9,16 +9,16 @@
namespace based
// clang-format off
template<class T>
struct RemoveExtent { using type = T; };
struct RemoveExtent { using Type = T; };
template<class T>
struct RemoveExtent<T[]> { using type = T; };
struct RemoveExtent<T[]> { using Type = T; };
template<class T, size_t n>
struct RemoveExtent<T[n]> { using type = T; };
template<class T, SizeT n>
struct RemoveExtent<T[n]> { using Type = T; };
template<class T> using remove_extent_t = RemoveExtent<T>::type;
template<class T> using RemoveExtentT = RemoveExtent<T>::Type;
// NOLINTEND(*array*)
// clang-format on
diff --git a/ include/based/trait/remove/pointer.hpp b/ include/based/trait/remove/pointer.hpp
@@ -5,13 +5,13 @@
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> 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 remove_pointer_t = typename RemovePointer<T>::type;
template<class T> using RemovePointerT = typename RemovePointer<T>::Type;
// clang-format on
diff --git a/ include/based/trait/remove/reference.hpp b/ include/based/trait/remove/reference.hpp
@@ -5,11 +5,11 @@
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> 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 remove_reference_t = typename RemoveReference<T>::type;
template<class T> using RemoveReferenceT = typename RemoveReference<T>::Type;
// clang-format on
diff --git a/ include/based/trait/remove/volatile.hpp b/ include/based/trait/remove/volatile.hpp
@@ -5,10 +5,10 @@
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> struct RemoveVolatile { using Type = T; };
template<class T> struct RemoveVolatile<volatile T> { using Type = T; };
template<class T> using remove_volatile_t = typename RemoveVolatile<T>::type;
template<class T> using RemoveVolatileT = typename RemoveVolatile<T>::Type;
// clang-format on
diff --git a/ include/based/trait/signature.hpp b/ include/based/trait/signature.hpp
@@ -2,6 +2,7 @@
#include <tuple>
#include "based/trait/conditional.hpp"
#include "based/trait/integral_constant.hpp"
namespace based
@@ -13,213 +14,213 @@
struct Signature;
template<typename Ret, bool ne, typename... Args>
struct Signature<Ret(Args...) noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename Ret, bool ne, typename... Args>
struct Signature<Ret (*)(Args...) noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename Ret, typename Obj, bool ne, typename... Args>
struct Signature<Ret (Obj::*)(Args...) noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using const_val = false_type;
using volatile_val = false_type;
using ConstVal = FalseType;
using VolatileVal = FalseType;
using lvalref_val = false_type;
using rvalref_val = false_type;
using LvalrefVal = FalseType;
using RvalrefVal = FalseType;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename Ret, typename Obj, bool ne, typename... Args>
struct Signature<Ret (Obj::*)(Args...) & noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using const_val = false_type;
using volatile_val = false_type;
using ConstVal = FalseType;
using VolatileVal = FalseType;
using lvalref_val = true_type;
using rvalref_val = false_type;
using LvalrefVal = TrueType;
using RvalrefVal = FalseType;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename Ret, typename Obj, bool ne, typename... Args>
struct Signature<Ret (Obj::*)(Args...) && noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using const_val = false_type;
using volatile_val = false_type;
using ConstVal = FalseType;
using VolatileVal = FalseType;
using lvalref_val = false_type;
using rvalref_val = true_type;
using LvalrefVal = FalseType;
using RvalrefVal = TrueType;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename Ret, typename Obj, bool ne, typename... Args>
struct Signature<Ret (Obj::*)(Args...) const noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using const_val = true_type;
using volatile_val = false_type;
using ConstVal = TrueType;
using VolatileVal = FalseType;
using lvalref_val = false_type;
using rvalref_val = false_type;
using LvalrefVal = FalseType;
using RvalrefVal = FalseType;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename Ret, typename Obj, bool ne, typename... Args>
struct Signature<Ret (Obj::*)(Args...) const & noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using const_val = true_type;
using volatile_val = false_type;
using ConstVal = TrueType;
using VolatileVal = FalseType;
using lvalref_val = true_type;
using rvalref_val = false_type;
using LvalrefVal = TrueType;
using RvalrefVal = FalseType;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename Ret, typename Obj, bool ne, typename... Args>
struct Signature<Ret (Obj::*)(Args...) const && noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using const_val = true_type;
using volatile_val = false_type;
using ConstVal = TrueType;
using VolatileVal = FalseType;
using lvalref_val = false_type;
using rvalref_val = true_type;
using LvalrefVal = FalseType;
using RvalrefVal = TrueType;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename Ret, typename Obj, bool ne, typename... Args>
struct Signature<Ret (Obj::*)(Args...) volatile noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using const_val = false_type;
using volatile_val = true_type;
using ConstVal = FalseType;
using VolatileVal = TrueType;
using lvalref_val = false_type;
using rvalref_val = false_type;
using LvalrefVal = FalseType;
using RvalrefVal = FalseType;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename Ret, typename Obj, bool ne, typename... Args>
struct Signature<Ret (Obj::*)(Args...) volatile & noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using const_val = false_type;
using volatile_val = true_type;
using ConstVal = FalseType;
using VolatileVal = TrueType;
using lvalref_val = true_type;
using rvalref_val = false_type;
using LvalrefVal = TrueType;
using RvalrefVal = FalseType;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename Ret, typename Obj, bool ne, typename... Args>
struct Signature<Ret (Obj::*)(Args...) volatile && noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using const_val = false_type;
using volatile_val = true_type;
using ConstVal = FalseType;
using VolatileVal = TrueType;
using lvalref_val = false_type;
using rvalref_val = true_type;
using LvalrefVal = FalseType;
using RvalrefVal = TrueType;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename Ret, typename Obj, bool ne, typename... Args>
struct Signature<Ret (Obj::*)(Args...) const volatile noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using const_val = true_type;
using volatile_val = true_type;
using ConstVal = TrueType;
using VolatileVal = TrueType;
using lvalref_val = false_type;
using rvalref_val = false_type;
using LvalrefVal = FalseType;
using RvalrefVal = FalseType;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename Ret, typename Obj, bool ne, typename... Args>
struct Signature<Ret (Obj::*)(Args...) const volatile & noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using const_val = true_type;
using volatile_val = true_type;
using ConstVal = TrueType;
using VolatileVal = TrueType;
using lvalref_val = true_type;
using rvalref_val = false_type;
using LvalrefVal = TrueType;
using RvalrefVal = FalseType;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename Ret, typename Obj, bool ne, typename... Args>
struct Signature<Ret (Obj::*)(Args...) const volatile && noexcept(ne)>
{
using sig_type = Ret(Args...);
using arg_type = std::tuple<Args...>;
using ret_type = Ret;
using SigType = Ret(Args...);
using ArgType = std::tuple<Args...>;
using RetType = Ret;
using const_val = true_type;
using volatile_val = true_type;
using ConstVal = TrueType;
using VolatileVal = TrueType;
using lvalref_val = false_type;
using rvalref_val = true_type;
using LvalrefVal = FalseType;
using RvalrefVal = TrueType;
using noexcept_val = IntegralConstant<bool, ne>;
using NoexceptVal = IntegralConstant<bool, ne>;
};
template<typename StaticCallOp>
@@ -230,13 +231,13 @@
struct SignatureStatic
template<typename Ret, bool ne, typename... Args>
struct SignatureStatic<Ret (*)(Args...) noexcept(ne)>
{
using sig_type = Ret(Args...);
using SigType = Ret(Args...);
};
template<typename F, typename Op>
using signature_t = typename std::conditional_t<requires(F& func) {
using SignatureT = typename ConditionalT<requires(F& func) {
(void)func.operator();
}, SignatureStatic<Op>, Signature<Op>>::sig_type;
}, SignatureStatic<Op>, Signature<Op>>::SigType;
/*
template<typename Sig>
@@ -250,7 +251,7 @@
class function<Ret(Args...)>
template<typename Ret, typename... Args>
function(Ret (*)(Args...)) -> function<Ret(Args...)>;
template<typename F, typename Sig = signature_t<F, decltype(&F::operator())>>
template<typename F, typename Sig = SignatureT<F, decltype(&F::operator())>>
function(F) -> function<Sig>;
*/
diff --git a/ include/based/trait/type_identity.hpp b/ include/based/trait/type_identity.hpp
@@ -5,9 +5,9 @@
namespace based
// clang-format off
template<class T> struct TypeIdentity { using type = T; };
template<class T> struct TypeIdentity { using Type = T; };
template<class T> using type_dentity_t = TypeIdentity<T>::type;
template<class T> using TypeDentityT = TypeIdentity<T>::Type;
// clang-format on
diff --git a/ include/based/utility/buffer.hpp b/ include/based/utility/buffer.hpp
@@ -12,7 +12,7 @@
namespace based
/* ----- Buffer used for Local Buffer Optimization ----- */
template<size_t size, size_t alignment = alignof(void*)>
template<SizeT size, SizeT alignment = alignof(void*)>
struct Buffer
{
template<typename T>
diff --git a/ include/based/utility/declvar.hpp b/ include/based/utility/declvar.hpp
@@ -6,7 +6,7 @@
namespace based
{
template<typename T>
add_rvalue_reference_t<T> declval() noexcept
AddRvalueReferenceT<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
@@ -7,14 +7,14 @@
namespace based
{
template<class T>
constexpr decltype(auto) forward(remove_reference_t<T>& tmp) noexcept
constexpr decltype(auto) forward(RemoveReferenceT<T>& tmp) noexcept
{
return static_cast<T&&>(tmp);
}
template<class T>
// NOLINTNEXTLINE(*move*)
constexpr decltype(auto) forward(remove_reference_t<T>&& tmp) noexcept
constexpr decltype(auto) forward(RemoveReferenceT<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
@@ -9,7 +9,7 @@
template<class T>
// NOLINTNEXTLINE(*forward*)
constexpr decltype(auto) move(T&& tmp) noexcept
{
return static_cast<remove_reference_t<T>&&>(tmp);
return static_cast<RemoveReferenceT<T>&&>(tmp);
}
} // namespace based
diff --git a/ include/based/utility/scopeguard.hpp b/ include/based/utility/scopeguard.hpp
@@ -74,12 +74,12 @@
public:
};
template<typename Func>
using scopeguard_exit = Scopeguard<Func, true, true>;
using ScopeguardExit = Scopeguard<Func, true, true>;
template<typename Func>
using scopeguard_success = Scopeguard<Func, true, false>;
using ScopeguardSuccess = Scopeguard<Func, true, false>;
template<typename Func>
using scopeguard_failure = Scopeguard<Func, false, true>;
using ScopeguardFailure = Scopeguard<Func, false, true>;
} // namespace based
diff --git a/ include/based/utility/static_view.hpp b/ include/based/utility/static_view.hpp
@@ -5,6 +5,7 @@
#include <span>
#include <string>
#include "based/trait/decay.hpp"
#include "based/utility/make_static.hpp"
namespace based
@@ -46,7 +47,7 @@
constexpr auto to_right_sized_array(auto callable)
{
constexpr auto oversized = to_oversized_array(callable());
using value_type = typename std::decay_t<decltype(oversized)>::value_type;
using value_type = typename DecayT<decltype(oversized)>::value_type;
std::array<value_type, oversized.size> result {};
std::ranges::copy(oversized, std::begin(result));
return result;
@@ -56,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 std::decay_t<decltype(static_data)>::value_type;
using value_type = typename DecayT<decltype(static_data)>::value_type;
const std::basic_string_view<value_type> result = {
std::begin(static_data), std::end(static_data)
};
@@ -67,7 +68,7 @@
consteval auto to_span(auto callable)
{
constexpr auto& static_data = make_static<to_right_sized_array(callable)>;
using value_type = typename std::decay_t<decltype(static_data)>::value_type;
using value_type = typename DecayT<decltype(static_data)>::value_type;
std::span<const value_type> result(static_data.begin(), static_data.end());
return result;
}
diff --git a/ test/source/algorithm/max_test.cpp b/ test/source/algorithm/max_test.cpp
@@ -11,17 +11,17 @@
TEST_CASE("max(literal, literal) = right", "[algorithm/max]")
{
using res_t = decltype(based::max(3, 4));
using ResT = decltype(based::max(3, 4));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::max(3, 4) == 4);
}
TEST_CASE("max(literal, literal) = left", "[algorithm/max]")
{
using res_t = decltype(based::max(4, 3));
using ResT = decltype(based::max(4, 3));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::max(4, 3) == 4);
}
@@ -29,9 +29,9 @@
TEST_CASE("max(value, literal) = right", "[algorithm/max]")
{
int a = 3;
using res_t = decltype(based::max(a, 4));
using ResT = decltype(based::max(a, 4));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(a, 4) == 4);
}
@@ -39,9 +39,9 @@
TEST_CASE("max(value, literal) = left", "[algorithm/max]")
{
int a = 4;
using res_t = decltype(based::max(a, 3));
using ResT = decltype(based::max(a, 3));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(a, 3) == 4);
}
@@ -49,9 +49,9 @@
TEST_CASE("max(literal, value) = right", "[algorithm/max]")
{
int b = 4;
using res_t = decltype(based::max(3, b));
using ResT = decltype(based::max(3, b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(3, b) == 4);
}
@@ -59,9 +59,9 @@
TEST_CASE("max(literal, value) = left", "[algorithm/max]")
{
int b = 3;
using res_t = decltype(based::max(4, b));
using ResT = decltype(based::max(4, b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(4, b) == 4);
}
@@ -70,9 +70,9 @@
TEST_CASE("max(value, value) = right", "[algorithm/max]")
int a = 3;
int b = 4;
using res_t = decltype(based::max(a, b));
using ResT = decltype(based::max(a, b));
STATIC_REQUIRE(based::SameAs<int&, res_t>);
STATIC_REQUIRE(based::SameAs<int&, ResT>);
REQUIRE(based::max(a, b) == 4);
}
@@ -81,9 +81,9 @@
TEST_CASE("max(value, value) = left", "[algorithm/max]")
int a = 4;
int b = 3;
using res_t = decltype(based::max(a, b));
using ResT = decltype(based::max(a, b));
STATIC_REQUIRE(based::SameAs<int&, res_t>);
STATIC_REQUIRE(based::SameAs<int&, ResT>);
REQUIRE(based::max(a, b) == 4);
}
@@ -91,9 +91,9 @@
TEST_CASE("max(const value, literal) = right", "[algorithm/max]")
{
const int a = 3;
using res_t = decltype(based::max(a, 4));
using ResT = decltype(based::max(a, 4));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(a, 4) == 4);
}
@@ -101,9 +101,9 @@
TEST_CASE("max(const value, literal) = left", "[algorithm/max]")
{
const int a = 4;
using res_t = decltype(based::max(a, 3));
using ResT = decltype(based::max(a, 3));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(a, 3) == 4);
}
@@ -111,9 +111,9 @@
TEST_CASE("max(literal, const value) = right", "[algorithm/max]")
{
const int b = 4;
using res_t = decltype(based::max(3, b));
using ResT = decltype(based::max(3, b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(3, b) == 4);
}
@@ -121,9 +121,9 @@
TEST_CASE("max(literal, const value) = left", "[algorithm/max]")
{
const int b = 3;
using res_t = decltype(based::max(4, b));
using ResT = decltype(based::max(4, b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(4, b) == 4);
}
@@ -132,9 +132,9 @@
TEST_CASE("max(const value, const value) = right", "[algorithm/max]")
const int a = 3;
const int b = 4;
using res_t = decltype(based::max(a, b));
using ResT = decltype(based::max(a, b));
STATIC_REQUIRE(based::SameAs<const int&, res_t>);
STATIC_REQUIRE(based::SameAs<const int&, ResT>);
REQUIRE(based::max(a, b) == 4);
}
@@ -143,9 +143,9 @@
TEST_CASE("max(const value, const value) = left", "[algorithm/max]")
const int a = 4;
const int b = 3;
using res_t = decltype(based::max(a, b));
using ResT = decltype(based::max(a, b));
STATIC_REQUIRE(based::SameAs<const int&, res_t>);
STATIC_REQUIRE(based::SameAs<const int&, ResT>);
REQUIRE(based::max(a, b) == 4);
}
@@ -154,9 +154,9 @@
TEST_CASE("max(value, const value) = right", "[algorithm/max]")
int a = 3;
const int b = 4;
using res_t = decltype(based::max(a, b));
using ResT = decltype(based::max(a, b));
STATIC_REQUIRE(based::SameAs<const int&, res_t>);
STATIC_REQUIRE(based::SameAs<const int&, ResT>);
REQUIRE(based::max(a, b) == 4);
}
@@ -165,9 +165,9 @@
TEST_CASE("max(value, const value) = left", "[algorithm/max]")
int a = 4;
const int b = 3;
using res_t = decltype(based::max(a, b));
using ResT = decltype(based::max(a, b));
STATIC_REQUIRE(based::SameAs<const int&, res_t>);
STATIC_REQUIRE(based::SameAs<const int&, ResT>);
REQUIRE(based::max(a, b) == 4);
}
@@ -176,9 +176,9 @@
TEST_CASE("max(const value, value) = right", "[algorithm/max]")
const int a = 3;
int b = 4;
using res_t = decltype(based::max(a, b));
using ResT = decltype(based::max(a, b));
STATIC_REQUIRE(based::SameAs<const int&, res_t>);
STATIC_REQUIRE(based::SameAs<const int&, ResT>);
REQUIRE(based::max(a, b) == 4);
}
@@ -187,9 +187,9 @@
TEST_CASE("max(const value, value) = left", "[algorithm/max]")
const int a = 4;
int b = 3;
using res_t = decltype(based::max(a, b));
using ResT = decltype(based::max(a, b));
STATIC_REQUIRE(based::SameAs<const int&, res_t>);
STATIC_REQUIRE(based::SameAs<const int&, ResT>);
REQUIRE(based::max(a, b) == 4);
}
@@ -197,9 +197,9 @@
TEST_CASE("max(move, literal) = right", "[algorithm/max]")
{
int a = 3;
using res_t = decltype(based::max(based::move(a), 4));
using ResT = decltype(based::max(based::move(a), 4));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::max(based::move(a), 4) == 4);
}
@@ -207,9 +207,9 @@
TEST_CASE("max(move, literal) = left", "[algorithm/max]")
{
int a = 4;
using res_t = decltype(based::max(based::move(a), 3));
using ResT = decltype(based::max(based::move(a), 3));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::max(based::move(a), 3) == 4);
}
@@ -218,9 +218,9 @@
TEST_CASE("max(move, value) = right", "[algorithm/max]")
int a = 3;
int b = 4;
using res_t = decltype(based::max(based::move(a), b));
using ResT = decltype(based::max(based::move(a), b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(based::move(a), b) == 4);
}
@@ -229,9 +229,9 @@
TEST_CASE("max(move, value) = left", "[algorithm/max]")
int a = 4;
int b = 3;
using res_t = decltype(based::max(based::move(a), b));
using ResT = decltype(based::max(based::move(a), b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(based::move(a), b) == 4);
}
@@ -240,9 +240,9 @@
TEST_CASE("max(move, const value) = right", "[algorithm/max]")
int a = 3;
const int b = 4;
using res_t = decltype(based::max(based::move(a), b));
using ResT = decltype(based::max(based::move(a), b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(based::move(a), b) == 4);
}
@@ -251,9 +251,9 @@
TEST_CASE("max(move, const value) = left", "[algorithm/max]")
int a = 4;
const int b = 3;
using res_t = decltype(based::max(based::move(a), b));
using ResT = decltype(based::max(based::move(a), b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(based::move(a), b) == 4);
}
@@ -261,9 +261,9 @@
TEST_CASE("max(literal, move) = right", "[algorithm/max]")
{
int b = 4;
using res_t = decltype(based::max(3, based::move(b)));
using ResT = decltype(based::max(3, based::move(b)));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::max(3, based::move(b)) == 4);
}
@@ -271,9 +271,9 @@
TEST_CASE("max(literal, move) = left", "[algorithm/max]")
{
int b = 3;
using res_t = decltype(based::max(4, based::move(b)));
using ResT = decltype(based::max(4, based::move(b)));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::max(4, based::move(b)) == 4);
}
@@ -282,9 +282,9 @@
TEST_CASE("max(value, move) = right", "[algorithm/max]")
int a = 3;
int b = 4;
using res_t = decltype(based::max(a, based::move(b)));
using ResT = decltype(based::max(a, based::move(b)));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(a, based::move(b)) == 4);
}
@@ -293,9 +293,9 @@
TEST_CASE("max(value, move) = left", "[algorithm/max]")
int a = 4;
int b = 3;
using res_t = decltype(based::max(a, based::move(b)));
using ResT = decltype(based::max(a, based::move(b)));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(a, based::move(b)) == 4);
}
@@ -304,9 +304,9 @@
TEST_CASE("max(const value, move) = right", "[algorithm/max]")
const int a = 3;
int b = 4;
using res_t = decltype(based::max(a, based::move(b)));
using ResT = decltype(based::max(a, based::move(b)));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(a, based::move(b)) == 4);
}
@@ -315,9 +315,9 @@
TEST_CASE("max(const value, move) = left", "[algorithm/max]")
const int a = 4;
int b = 3;
using res_t = decltype(based::max(a, based::move(b)));
using ResT = decltype(based::max(a, based::move(b)));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::max(a, based::move(b)) == 4);
}
@@ -326,9 +326,9 @@
TEST_CASE("max(move, move) = right", "[algorithm/max]")
int a = 3;
int b = 4;
using res_t = decltype(based::max(based::move(a), based::move(b)));
using ResT = decltype(based::max(based::move(a), based::move(b)));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::max(based::move(a), based::move(b)) == 4);
}
@@ -337,9 +337,9 @@
TEST_CASE("max(move, move) = left", "[algorithm/max]")
int a = 4;
int b = 3;
using res_t = decltype(based::max(based::move(a), based::move(b)));
using ResT = decltype(based::max(based::move(a), based::move(b)));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::max(based::move(a), based::move(b)) == 4);
}
@@ -347,15 +347,15 @@
TEST_CASE("max(move, move) = left", "[algorithm/max]")
TEST_CASE("max-stability", "[algorithm/max]")
{
using type_t = std::pair<int, int>;
using TypeT = std::pair<int, int>;
static const auto cmp = [](const type_t& x, const type_t& y)
static const auto cmp = [](const TypeT& x, const TypeT& y)
{
return x.first < y.first;
};
const type_t a = {3, 4};
const type_t b = {3, 5};
const TypeT a = {3, 4};
const TypeT b = {3, 5};
REQUIRE(based::max(a, b, cmp).second == 5);
REQUIRE(based::max(b, a, cmp).second == 4);
diff --git a/ test/source/algorithm/min_test.cpp b/ test/source/algorithm/min_test.cpp
@@ -10,17 +10,17 @@
TEST_CASE("min(literal, literal) = left", "[algorithm/min]")
{
using res_t = decltype(based::min(3, 4));
using ResT = decltype(based::min(3, 4));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::min(3, 4) == 3);
}
TEST_CASE("min(literal, literal) = right", "[algorithm/min]")
{
using res_t = decltype(based::min(4, 3));
using ResT = decltype(based::min(4, 3));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::min(4, 3) == 3);
}
@@ -28,9 +28,9 @@
TEST_CASE("min(value, literal) = left", "[algorithm/min]")
{
int a = 3;
using res_t = decltype(based::min(a, 4));
using ResT = decltype(based::min(a, 4));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(a, 4) == 3);
}
@@ -38,9 +38,9 @@
TEST_CASE("min(value, literal) = right", "[algorithm/min]")
{
int a = 4;
using res_t = decltype(based::min(a, 3));
using ResT = decltype(based::min(a, 3));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(a, 3) == 3);
}
@@ -48,9 +48,9 @@
TEST_CASE("min(literal, value) = left", "[algorithm/min]")
{
int b = 4;
using res_t = decltype(based::min(3, b));
using ResT = decltype(based::min(3, b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(3, b) == 3);
}
@@ -58,9 +58,9 @@
TEST_CASE("min(literal, value) = right", "[algorithm/min]")
{
int b = 3;
using res_t = decltype(based::min(4, b));
using ResT = decltype(based::min(4, b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(4, b) == 3);
}
@@ -69,9 +69,9 @@
TEST_CASE("min(value, value) = left", "[algorithm/min]")
int a = 3;
int b = 4;
using res_t = decltype(based::min(a, b));
using ResT = decltype(based::min(a, b));
STATIC_REQUIRE(based::SameAs<int&, res_t>);
STATIC_REQUIRE(based::SameAs<int&, ResT>);
REQUIRE(based::min(a, b) == 3);
}
@@ -80,9 +80,9 @@
TEST_CASE("min(value, value) = right", "[algorithm/min]")
int a = 4;
int b = 3;
using res_t = decltype(based::min(a, b));
using ResT = decltype(based::min(a, b));
STATIC_REQUIRE(based::SameAs<int&, res_t>);
STATIC_REQUIRE(based::SameAs<int&, ResT>);
REQUIRE(based::min(a, b) == 3);
}
@@ -90,9 +90,9 @@
TEST_CASE("min(const value, literal) = left", "[algorithm/min]")
{
const int a = 3;
using res_t = decltype(based::min(a, 4));
using ResT = decltype(based::min(a, 4));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(a, 4) == 3);
}
@@ -100,9 +100,9 @@
TEST_CASE("min(const value, literal) = right", "[algorithm/min]")
{
const int a = 4;
using res_t = decltype(based::min(a, 3));
using ResT = decltype(based::min(a, 3));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(a, 3) == 3);
}
@@ -110,9 +110,9 @@
TEST_CASE("min(literal, const value) = left", "[algorithm/min]")
{
const int b = 4;
using res_t = decltype(based::min(3, b));
using ResT = decltype(based::min(3, b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(3, b) == 3);
}
@@ -120,9 +120,9 @@
TEST_CASE("min(literal, const value) = right", "[algorithm/min]")
{
const int b = 3;
using res_t = decltype(based::min(4, b));
using ResT = decltype(based::min(4, b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(4, b) == 3);
}
@@ -131,9 +131,9 @@
TEST_CASE("min(const value, const value) = left", "[algorithm/min]")
const int a = 3;
const int b = 4;
using res_t = decltype(based::min(a, b));
using ResT = decltype(based::min(a, b));
STATIC_REQUIRE(based::SameAs<const int&, res_t>);
STATIC_REQUIRE(based::SameAs<const int&, ResT>);
REQUIRE(based::min(a, b) == 3);
}
@@ -142,9 +142,9 @@
TEST_CASE("min(const value, const value) = right", "[algorithm/min]")
const int a = 4;
const int b = 3;
using res_t = decltype(based::min(a, b));
using ResT = decltype(based::min(a, b));
STATIC_REQUIRE(based::SameAs<const int&, res_t>);
STATIC_REQUIRE(based::SameAs<const int&, ResT>);
REQUIRE(based::min(a, b) == 3);
}
@@ -153,9 +153,9 @@
TEST_CASE("min(value, const value) = left", "[algorithm/min]")
int a = 3;
const int b = 4;
using res_t = decltype(based::min(a, b));
using ResT = decltype(based::min(a, b));
STATIC_REQUIRE(based::SameAs<const int&, res_t>);
STATIC_REQUIRE(based::SameAs<const int&, ResT>);
REQUIRE(based::min(a, b) == 3);
}
@@ -164,9 +164,9 @@
TEST_CASE("min(value, const value) = right", "[algorithm/min]")
int a = 4;
const int b = 3;
using res_t = decltype(based::min(a, b));
using ResT = decltype(based::min(a, b));
STATIC_REQUIRE(based::SameAs<const int&, res_t>);
STATIC_REQUIRE(based::SameAs<const int&, ResT>);
REQUIRE(based::min(a, b) == 3);
}
@@ -175,9 +175,9 @@
TEST_CASE("min(const value, value) = left", "[algorithm/min]")
const int a = 3;
int b = 4;
using res_t = decltype(based::min(a, b));
using ResT = decltype(based::min(a, b));
STATIC_REQUIRE(based::SameAs<const int&, res_t>);
STATIC_REQUIRE(based::SameAs<const int&, ResT>);
REQUIRE(based::min(a, b) == 3);
}
@@ -186,9 +186,9 @@
TEST_CASE("min(const value, value) = right", "[algorithm/min]")
const int a = 4;
int b = 3;
using res_t = decltype(based::min(a, b));
using ResT = decltype(based::min(a, b));
STATIC_REQUIRE(based::SameAs<const int&, res_t>);
STATIC_REQUIRE(based::SameAs<const int&, ResT>);
REQUIRE(based::min(a, b) == 3);
}
@@ -196,9 +196,9 @@
TEST_CASE("min(move, literal) = left", "[algorithm/min]")
{
int a = 3;
using res_t = decltype(based::min(based::move(a), 4));
using ResT = decltype(based::min(based::move(a), 4));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::min(based::move(a), 4) == 3);
}
@@ -206,9 +206,9 @@
TEST_CASE("min(move, literal) = right", "[algorithm/min]")
{
int a = 4;
using res_t = decltype(based::min(based::move(a), 3));
using ResT = decltype(based::min(based::move(a), 3));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::min(based::move(a), 3) == 3);
}
@@ -217,9 +217,9 @@
TEST_CASE("min(move, value) = left", "[algorithm/min]")
int a = 3;
int b = 4;
using res_t = decltype(based::min(based::move(a), b));
using ResT = decltype(based::min(based::move(a), b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(based::move(a), b) == 3);
}
@@ -228,9 +228,9 @@
TEST_CASE("min(move, value) = right", "[algorithm/min]")
int a = 4;
int b = 3;
using res_t = decltype(based::min(based::move(a), b));
using ResT = decltype(based::min(based::move(a), b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(based::move(a), b) == 3);
}
@@ -239,9 +239,9 @@
TEST_CASE("min(move, const value) = left", "[algorithm/min]")
int a = 3;
const int b = 4;
using res_t = decltype(based::min(based::move(a), b));
using ResT = decltype(based::min(based::move(a), b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(based::move(a), b) == 3);
}
@@ -250,9 +250,9 @@
TEST_CASE("min(move, const value) = right", "[algorithm/min]")
int a = 4;
const int b = 3;
using res_t = decltype(based::min(based::move(a), b));
using ResT = decltype(based::min(based::move(a), b));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(based::move(a), b) == 3);
}
@@ -260,9 +260,9 @@
TEST_CASE("min(literal, move) = left", "[algorithm/min]")
{
int b = 4;
using res_t = decltype(based::min(3, based::move(b)));
using ResT = decltype(based::min(3, based::move(b)));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::min(3, based::move(b)) == 3);
}
@@ -270,9 +270,9 @@
TEST_CASE("min(literal, move) = right", "[algorithm/min]")
{
int b = 3;
using res_t = decltype(based::min(4, based::move(b)));
using ResT = decltype(based::min(4, based::move(b)));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::min(4, based::move(b)) == 3);
}
@@ -281,9 +281,9 @@
TEST_CASE("min(value, move) = left", "[algorithm/min]")
int a = 3;
int b = 4;
using res_t = decltype(based::min(a, based::move(b)));
using ResT = decltype(based::min(a, based::move(b)));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(a, based::move(b)) == 3);
}
@@ -292,9 +292,9 @@
TEST_CASE("min(value, move) = right", "[algorithm/min]")
int a = 4;
int b = 3;
using res_t = decltype(based::min(a, based::move(b)));
using ResT = decltype(based::min(a, based::move(b)));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(a, based::move(b)) == 3);
}
@@ -303,9 +303,9 @@
TEST_CASE("min(const value, move) = left", "[algorithm/min]")
const int a = 3;
int b = 4;
using res_t = decltype(based::min(a, based::move(b)));
using ResT = decltype(based::min(a, based::move(b)));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(a, based::move(b)) == 3);
}
@@ -314,9 +314,9 @@
TEST_CASE("min(const value, move) = right", "[algorithm/min]")
const int a = 4;
int b = 3;
using res_t = decltype(based::min(a, based::move(b)));
using ResT = decltype(based::min(a, based::move(b)));
STATIC_REQUIRE(based::SameAs<int, res_t>);
STATIC_REQUIRE(based::SameAs<int, ResT>);
REQUIRE(based::min(a, based::move(b)) == 3);
}
@@ -325,9 +325,9 @@
TEST_CASE("min(move, move) = left", "[algorithm/min]")
int a = 3;
int b = 4;
using res_t = decltype(based::min(based::move(a), based::move(b)));
using ResT = decltype(based::min(based::move(a), based::move(b)));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::min(based::move(a), based::move(b)) == 3);
}
@@ -336,9 +336,9 @@
TEST_CASE("min(move, move) = right", "[algorithm/min]")
int a = 4;
int b = 3;
using res_t = decltype(based::min(based::move(a), based::move(b)));
using ResT = decltype(based::min(based::move(a), based::move(b)));
STATIC_REQUIRE(based::SameAs<int&&, res_t>);
STATIC_REQUIRE(based::SameAs<int&&, ResT>);
REQUIRE(based::min(based::move(a), based::move(b)) == 3);
}
@@ -346,15 +346,15 @@
TEST_CASE("min(move, move) = right", "[algorithm/min]")
TEST_CASE("min-stability", "[algorithm/min]")
{
using type_t = std::pair<int, int>;
using TypeT = std::pair<int, int>;
static const auto cmp = [](const type_t& x, const type_t& y)
static const auto cmp = [](const TypeT& x, const TypeT& y)
{
return x.first < y.first;
};
const type_t a = {3, 4};
const type_t b = {3, 5};
const TypeT a = {3, 4};
const TypeT b = {3, 5};
REQUIRE(based::min(a, b, cmp).second == 4);
REQUIRE(based::min(b, a, cmp).second == 5);
diff --git a/ test/source/concept/callable_test.cpp b/ test/source/concept/callable_test.cpp
@@ -21,11 +21,11 @@
using based::SameAs;
TEST_CASE("free function", "[concept/callable]")
{
using type_t = decltype(free_func);
using TypeT = decltype(free_func);
STATIC_REQUIRE(based::Callable<type_t>);
STATIC_REQUIRE(SameAs<based::callable_sig_t<type_t>, int(int, double)>);
STATIC_REQUIRE(SameAs<based::callable_ret_t<type_t>, int>);
STATIC_REQUIRE(based::Callable<TypeT>);
STATIC_REQUIRE(SameAs<based::CallableSigT<TypeT>, int(int, double)>);
STATIC_REQUIRE(SameAs<based::CallableRetT<TypeT>, int>);
}
TEST_CASE("lambda", "[concept/callable]")
@@ -34,11 +34,11 @@
TEST_CASE("lambda", "[concept/callable]")
{
return static_cast<int>(a + b);
};
using type_t = decltype(func);
using TypeT = decltype(func);
STATIC_REQUIRE(based::Callable<type_t>);
STATIC_REQUIRE(SameAs<based::callable_sig_t<type_t>, int(int, double)>);
STATIC_REQUIRE(SameAs<based::callable_ret_t<type_t>, int>);
STATIC_REQUIRE(based::Callable<TypeT>);
STATIC_REQUIRE(SameAs<based::CallableSigT<TypeT>, int(int, double)>);
STATIC_REQUIRE(SameAs<based::CallableRetT<TypeT>, int>);
}
/*
@@ -54,7 +54,7 @@
TEST_CASE("member function", "[concept/callable]")
// based::error_template<decltype(&func::template operator()<int, double>)>();
STATIC_REQUIRE(based::Callable<func>);
STATIC_REQUIRE(SameAs<based::callable_sig_t<func>, int(int, double)>);
STATIC_REQUIRE(SameAs<based::callable_ret_t<func>, int>);
STATIC_REQUIRE(SameAs<based::CallableSigT<func>, int(int, double)>);
STATIC_REQUIRE(SameAs<based::CallableRetT<func>, int>);
}
*/
diff --git a/ test/source/container/list_test.cpp b/ test/source/container/list_test.cpp
@@ -13,9 +13,9 @@
template class based::ListPool<based::U8, based::U8>;
TEST_CASE("ListPool", "[container/ListPool]")
{
using namespace based::literals; // NOLINT(*namespace*)
using list_pool = based::ListPool<based::U8, based::U8>;
using ListPool = based::ListPool<based::U8, based::U8>;
auto pool = list_pool();
auto pool = ListPool();
auto head = pool.node_empty();
SECTION("node_empty is empty")
@@ -68,9 +68,9 @@
TEST_CASE("ListPool", "[container/ListPool]")
TEST_CASE("ListPool iterator", "[container/ListPool]")
{
using namespace based::literals; // NOLINT(*namespace*)
using list_pool = based::ListPool<based::U8, based::U8>;
using ListPool = based::ListPool<based::U8, based::U8>;
auto pool = list_pool();
auto pool = ListPool();
auto head = pool.node_empty();
static constexpr auto iter_count = 255_u8;
@@ -80,10 +80,10 @@
TEST_CASE("ListPool iterator", "[container/ListPool]")
SECTION("for-loop")
{
using iter = list_pool::iterator;
using Iter = ListPool::Iterator;
auto sum = 0_U32;
for (auto it = iter(pool, head); it != iter(pool); it++) {
for (auto it = Iter(pool, head); it != Iter(pool); it++) {
sum += *it.operator->();
sum += *it;
}
@@ -93,11 +93,11 @@
TEST_CASE("ListPool iterator", "[container/ListPool]")
SECTION("accumulate")
{
using iter = list_pool::iterator;
using Iter = ListPool::Iterator;
const auto sum = std::accumulate(
iter(pool, head),
iter(pool),
Iter(pool, head),
Iter(pool),
based::U32 {0},
[](auto a, auto b)
{
@@ -114,9 +114,9 @@
TEST_CASE("ListPool iterator", "[container/ListPool]")
TEST_CASE("ListPool const iterator", "[container/ListPool]")
{
using namespace based::literals; // NOLINT(*namespace*)
using list_pool = based::ListPool<based::U8, based::U8>;
using ListPool = based::ListPool<based::U8, based::U8>;
auto pool = list_pool();
auto pool = ListPool();
auto head = pool.node_empty();
static constexpr auto iter_count = 255_u8;
@@ -126,10 +126,10 @@
TEST_CASE("ListPool const iterator", "[container/ListPool]")
SECTION("const for-loop")
{
using iter = list_pool::const_iterator;
using Iter = ListPool::ConstIterator;
auto sum = 0_U32;
for (auto it = iter(pool, head); it != iter(pool); it++) {
for (auto it = Iter(pool, head); it != Iter(pool); it++) {
sum += *it.operator->();
sum += *it;
}
@@ -139,14 +139,14 @@
TEST_CASE("ListPool const iterator", "[container/ListPool]")
SECTION("const accumulate")
{
using iter = list_pool::const_iterator;
using Iter = ListPool::ConstIterator;
static const auto sum =
[](const list_pool& lpool, const list_pool::list_type& lhead)
[](const ListPool& lpool, const ListPool::ListType& lhead)
{
return std::accumulate(
iter(lpool, lhead),
iter(lpool),
Iter(lpool, lhead),
Iter(lpool),
based::U32 {0},
[](auto a, auto b)
{
@@ -163,10 +163,10 @@
TEST_CASE("ListPool const iterator", "[container/ListPool]")
TEST_CASE("ListPool queue", "[container/ListPool/queue]")
{
using list_pool = based::ListPool<based::U8, based::U8>;
using iter = list_pool::iterator;
using ListPool = based::ListPool<based::U8, based::U8>;
using Iter = ListPool::Iterator;
auto pool = list_pool();
auto pool = ListPool();
auto queue = pool.queue_empty();
SECTION("free(empty, empty)")
@@ -196,7 +196,7 @@
TEST_CASE("ListPool queue", "[container/ListPool/queue]")
}
auto sum = 0_U64;
for (auto it = iter(pool, queue.first); it != iter(pool); ++it) {
for (auto it = Iter(pool, queue.first); it != Iter(pool); ++it) {
sum += *it;
}
diff --git a/ test/source/enum/bitmask_test.cpp b/ test/source/enum/bitmask_test.cpp
@@ -1,10 +1,9 @@
#define CATCH_CONFIG_RUNTIME_STATIC_REQUIRE
#include "based/enum/enum.hpp"
#include <catch2/catch_test_macros.hpp>
#include "based/concept/is/same.hpp"
#include "based/enum/enum.hpp"
#include "based/integral/types.hpp"
BASED_ENUM_BITMASK(var, based::U8) {
diff --git a/ test/source/functional/function_test.cpp b/ test/source/functional/function_test.cpp
@@ -12,11 +12,11 @@
int identity(int a)
} // namespace
template class based::function<decltype(identity)>;
template class based::Function<decltype(identity)>;
TEST_CASE("empty", "[template/function]")
{
const based::function<void()> func;
const based::Function<void()> func;
try {
func();
@@ -30,14 +30,14 @@
TEST_CASE("empty", "[template/function]")
TEST_CASE("free function", "[template/function]")
{
const based::function func = identity;
const based::Function func = identity;
REQUIRE(func(3) == 3);
}
TEST_CASE("lambda function", "[template/function]")
{
const based::function func = [](int a)
const based::Function func = [](int a)
{
return a;
};
diff --git a/ test/source/trait/invoke_result_test.cpp b/ test/source/trait/invoke_result_test.cpp
@@ -15,7 +15,7 @@
int func(double);
} // namespace
template<class Res, class T, class... Args>
concept Test = based::SameAs<based::invoke_result_t<T, Args...>, Res>;
concept Test = based::SameAs<based::InvokeResultT<T, Args...>, Res>;
TEST_CASE("invoke_result", "[trait/invoke_result]")
{
diff --git a/ test/source/trait/is_base_of_test.cpp b/ test/source/trait/is_base_of_test.cpp
@@ -12,7 +12,7 @@
TEST_CASE("is_base_of", "[trait/is_base_of]")
class C : B {};
class D {};
union e {};
using i = int;
using I = int;
STATIC_REQUIRE(based::is_base_of_v<A, A>);
STATIC_REQUIRE(based::is_base_of_v<A, B>);
@@ -20,6 +20,6 @@
TEST_CASE("is_base_of", "[trait/is_base_of]")
STATIC_REQUIRE(!based::is_base_of_v<A, D>);
STATIC_REQUIRE(!based::is_base_of_v<B, A>);
STATIC_REQUIRE(!based::is_base_of_v<e, e>);
STATIC_REQUIRE(!based::is_base_of_v<i, i>);
STATIC_REQUIRE(!based::is_base_of_v<I, I>);
// clang-format on
}
diff --git a/ test/source/trait/is_class_test.cpp b/ test/source/trait/is_class_test.cpp
@@ -12,12 +12,12 @@
TEST_CASE("is_class", "[trait/is_class]")
enum class e {};
union u { class Uc {}; };
STATIC_REQUIRE(std::is_class<A>::value);
STATIC_REQUIRE(based::is_class_v<A>);
STATIC_REQUIRE(based::is_class_v<B>);
STATIC_REQUIRE(!based::is_class_v<B*>);
STATIC_REQUIRE(!based::is_class_v<B&>);
STATIC_REQUIRE(based::is_class_v<const B>);
STATIC_REQUIRE(!std::is_class<e>::value);
STATIC_REQUIRE(!based::is_class_v<e>);
STATIC_REQUIRE(!based::is_class_v<u>);
STATIC_REQUIRE(based::is_class_v<u::Uc>);
STATIC_REQUIRE(!based::is_class_v<int>);
diff --git a/ test/source/trait/remove_const_test.cpp b/ test/source/trait/remove_const_test.cpp
@@ -11,27 +11,27 @@
TEST_CASE("remove_const", "[trait/remove/remove_const]")
{
// NOLINTBEGIN(*array*)
// clang-format off
STATIC_REQUIRE(SameAs<based::remove_const_t<int>, int>);
STATIC_REQUIRE(SameAs<based::remove_const_t<int&>, int&>);
STATIC_REQUIRE(SameAs<based::remove_const_t<int&&>, int&&>);
STATIC_REQUIRE(SameAs<based::remove_const_t<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_const_t<int(&)[2]>, int(&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_const_t<int(&&)[2]>, int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_const_t<const int>, int>);
STATIC_REQUIRE(SameAs<based::remove_const_t<const int&>, const int&>);
STATIC_REQUIRE(SameAs<based::remove_const_t<const int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_const_t<const int(&)[2]>, const int(&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_const_t<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::remove_const_t<volatile int>, volatile int>);
STATIC_REQUIRE(SameAs<based::remove_const_t<volatile int&>, volatile int&>);
STATIC_REQUIRE(SameAs<based::remove_const_t<volatile int&&>, volatile int&&>);
STATIC_REQUIRE(SameAs<based::remove_const_t<volatile int[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::remove_const_t<volatile int(&)[2]>, volatile int(&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_const_t<volatile int(&&)[2]>, volatile int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_const_t<const volatile int>, volatile int>);
STATIC_REQUIRE(SameAs<based::remove_const_t<const volatile int&>, volatile const int&>);
STATIC_REQUIRE(SameAs<based::remove_const_t<const volatile int[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::remove_const_t<const volatile int(&)[2]>, volatile const int(&)[2]>);
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]>);
// clang-format on
// NOLINTEND(*array*)
}
diff --git a/ test/source/trait/remove_cv_test.cpp b/ test/source/trait/remove_cv_test.cpp
@@ -11,27 +11,27 @@
TEST_CASE("remove_cv", "[trait/remove_cv]")
{
// NOLINTBEGIN(*array*)
// clang-format off
STATIC_REQUIRE(SameAs<based::remove_cv_t<int>, int>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<int&>, int&>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<int&&>, int&&>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<int(&)[2]>, int(&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<int(&&)[2]>, int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<const int>, int>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<const int&>, const int&>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<const int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<const int(&)[2]>, const int(&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<volatile int>, int>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<volatile int&>, volatile int&>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<volatile int&&>, volatile int&&>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<volatile int(&)[2]>, volatile int(&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<volatile int(&&)[2]>, volatile int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<const volatile int>, int>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<const volatile int&>, volatile const int&>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<const volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_cv_t<const volatile int(&)[2]>, volatile const int(&)[2]>);
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]>);
// clang-format on
// NOLINTEND(*array*)
}
diff --git a/ test/source/trait/remove_cvref_test.cpp b/ test/source/trait/remove_cvref_test.cpp
@@ -11,27 +11,27 @@
TEST_CASE("remove_cvref", "[trait/remove_cvref]")
{
// NOLINTBEGIN(*array*)
// clang-format off
STATIC_REQUIRE(SameAs<based::remove_cvref_t<int>, int>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<int&>, int>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<int&&>, int>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<int(&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<int(&&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<const int>, int>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<const int&>, int>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<const int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<const int(&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<volatile int>, int>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<volatile int&>, int>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<volatile int&&>, int>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<volatile int(&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<volatile int(&&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<const volatile int>, int>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<const volatile int&>, int>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<const volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_cvref_t<const volatile int(&)[2]>, int[2]>);
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]>);
// clang-format on
// NOLINTEND(*array*)
}
diff --git a/ test/source/trait/remove_pointer_test.cpp b/ test/source/trait/remove_pointer_test.cpp
@@ -11,12 +11,12 @@
TEST_CASE("remove_pointer", "[trait/remove_pointer]")
{
// NOLINTBEGIN(*array*)
// clang-format off
STATIC_REQUIRE(SameAs<based::remove_pointer_t<int>, int>);
STATIC_REQUIRE(SameAs<based::remove_pointer_t<int*>, int>);
STATIC_REQUIRE(SameAs<based::remove_pointer_t<int**>, int*>);
STATIC_REQUIRE(SameAs<based::remove_pointer_t<int* const>, int>);
STATIC_REQUIRE(SameAs<based::remove_pointer_t<int* volatile>, int>);
STATIC_REQUIRE(SameAs<based::remove_pointer_t<int* const volatile>, int>);
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>);
// clang-format on
// NOLINTEND(*array*)
}
diff --git a/ test/source/trait/remove_reference_test.cpp b/ test/source/trait/remove_reference_test.cpp
@@ -11,27 +11,27 @@
TEST_CASE("remove_reference", "[trait/remove_reference]")
{
// NOLINTBEGIN(*array*)
// clang-format off
STATIC_REQUIRE(SameAs<based::remove_reference_t<int>, int>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<int&>, int>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<int&&>, int>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<int(&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<int(&&)[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<const int>, const int>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<const int&>, const int>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<const int[2]>, const int[2]>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<const int(&)[2]>, const int[2]>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<volatile int>,volatile int>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<volatile int&>, volatile int>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<volatile int&&>, volatile int>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<volatile int[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<volatile int(&)[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<volatile int(&&)[2]>, volatile int[2]>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<const volatile int>, const volatile int>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<const volatile int&>, volatile const int>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<const volatile int[2]>, const volatile int[2]>);
STATIC_REQUIRE(SameAs<based::remove_reference_t<const volatile int(&)[2]>, volatile const int[2]>);
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]>);
// clang-format on
// NOLINTEND(*array*)
}
diff --git a/ test/source/trait/remove_volatile_test.cpp b/ test/source/trait/remove_volatile_test.cpp
@@ -11,27 +11,27 @@
TEST_CASE("remove_volatile", "[trait/remove/remove_volatile]")
{
// NOLINTBEGIN(*array*)
// clang-format off
STATIC_REQUIRE(SameAs<based::remove_volatile_t<int>, int>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<int&>, int&>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<int&&>, int&&>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<int(&)[2]>, int(&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<int(&&)[2]>, int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<const int>, const int>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<const int&>, const int&>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<const int[2]>, const int[2]>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<const int(&)[2]>, const int(&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<int(int)>, int(int)>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<volatile int>, int>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<volatile int&>, volatile int&>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<volatile int&&>, volatile int&&>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<volatile int[2]>, int[2]>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<volatile int(&)[2]>, volatile int(&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<volatile int(&&)[2]>, volatile int(&&)[2]>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<const volatile int>, const int>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<const volatile int&>, volatile const int&>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<const volatile int[2]>, const int[2]>);
STATIC_REQUIRE(SameAs<based::remove_volatile_t<const volatile int(&)[2]>, volatile const int(&)[2]>);
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]>);
// clang-format on
// NOLINTEND(*array*)
}
diff --git a/ test/source/trait/signature_test.cpp b/ test/source/trait/signature_test.cpp
@@ -28,20 +28,20 @@
using based::SameAs;
TEST_CASE("free function", "[trait/Signature]")
{
using sig = based::Signature<decltype(free_func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::false_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(free_func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::NoexceptVal>);
}
TEST_CASE("free function noexcept", "[trait/Signature]")
{
using sig = based::Signature<decltype(free_func_noexcept)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::true_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(free_func_noexcept)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::NoexceptVal>);
}
TEST_CASE("empty", "[trait/Signature]")
@@ -51,15 +51,15 @@
TEST_CASE("empty", "[trait/Signature]")
int func(const double& a, int&& b) noexcept(false);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::false_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::NoexceptVal>);
}
TEST_CASE("const", "[trait/Signature]")
@@ -69,15 +69,15 @@
TEST_CASE("const", "[trait/Signature]")
int func(const double& a, int&& b) const noexcept(false);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::true_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::NoexceptVal>);
}
TEST_CASE("volatile", "[trait/Signature]")
@@ -87,15 +87,15 @@
TEST_CASE("volatile", "[trait/Signature]")
int func(const double& a, int&& b) volatile noexcept(false);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::false_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::NoexceptVal>);
}
TEST_CASE("const volatile", "[trait/Signature]")
@@ -105,15 +105,15 @@
TEST_CASE("const volatile", "[trait/Signature]")
int func(const double& a, int&& b) const volatile noexcept(false);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::true_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::NoexceptVal>);
}
TEST_CASE("noexcept", "[trait/Signature]")
@@ -123,15 +123,15 @@
TEST_CASE("noexcept", "[trait/Signature]")
int func(const double& a, int&& b) noexcept(true);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::false_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::NoexceptVal>);
}
TEST_CASE("const noexcept", "[trait/Signature]")
@@ -141,15 +141,15 @@
TEST_CASE("const noexcept", "[trait/Signature]")
int func(const double& a, int&& b) const noexcept(true);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::true_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::NoexceptVal>);
}
TEST_CASE("volatile noexcept", "[trait/Signature]")
@@ -159,15 +159,15 @@
TEST_CASE("volatile noexcept", "[trait/Signature]")
int func(const double& a, int&& b) volatile noexcept(true);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::false_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::NoexceptVal>);
}
TEST_CASE("const volatile noexcept", "[trait/Signature]")
@@ -177,15 +177,15 @@
TEST_CASE("const volatile noexcept", "[trait/Signature]")
int func(const double& a, int&& b) const volatile noexcept(true);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::true_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::NoexceptVal>);
}
TEST_CASE("lvalref", "[trait/Signature]")
@@ -195,15 +195,15 @@
TEST_CASE("lvalref", "[trait/Signature]")
int func(const double& a, int&& b) & noexcept(false);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::false_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::NoexceptVal>);
}
TEST_CASE("const lvalref", "[trait/Signature]")
@@ -213,15 +213,15 @@
TEST_CASE("const lvalref", "[trait/Signature]")
int func(const double& a, int&& b) const& noexcept(false);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::true_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::NoexceptVal>);
}
TEST_CASE("volatile lvalref", "[trait/Signature]")
@@ -231,15 +231,15 @@
TEST_CASE("volatile lvalref", "[trait/Signature]")
int func(const double& a, int&& b) volatile& noexcept(false);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::false_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::NoexceptVal>);
}
TEST_CASE("const volatile lvalref", "[trait/Signature]")
@@ -249,15 +249,15 @@
TEST_CASE("const volatile lvalref", "[trait/Signature]")
int func(const double& a, int&& b) const volatile& noexcept(false);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::true_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::NoexceptVal>);
}
TEST_CASE("noexcept lvalref", "[trait/Signature]")
@@ -267,15 +267,15 @@
TEST_CASE("noexcept lvalref", "[trait/Signature]")
int func(const double& a, int&& b) & noexcept(true);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::false_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::NoexceptVal>);
}
TEST_CASE("const noexcept lvalref", "[trait/Signature]")
@@ -285,15 +285,15 @@
TEST_CASE("const noexcept lvalref", "[trait/Signature]")
int func(const double& a, int&& b) const& noexcept(true);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::true_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::NoexceptVal>);
}
TEST_CASE("volatile noexcept lvalref", "[trait/Signature]")
@@ -303,15 +303,15 @@
TEST_CASE("volatile noexcept lvalref", "[trait/Signature]")
int func(const double& a, int&& b) volatile& noexcept(true);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::false_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::NoexceptVal>);
}
TEST_CASE("const volatile noexcept lvalref", "[trait/Signature]")
@@ -321,15 +321,15 @@
TEST_CASE("const volatile noexcept lvalref", "[trait/Signature]")
int func(const double& a, int&& b) const volatile& noexcept(true);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::true_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::NoexceptVal>);
}
TEST_CASE("rvalref", "[trait/Signature]")
@@ -339,15 +339,15 @@
TEST_CASE("rvalref", "[trait/Signature]")
int func(const double& a, int&& b) && noexcept(false);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::false_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::NoexceptVal>);
}
TEST_CASE("const rvalref", "[trait/Signature]")
@@ -357,15 +357,15 @@
TEST_CASE("const rvalref", "[trait/Signature]")
int func(const double& a, int&& b) const&& noexcept(false);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::true_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::NoexceptVal>);
}
TEST_CASE("volatile rvalref", "[trait/Signature]")
@@ -375,15 +375,15 @@
TEST_CASE("volatile rvalref", "[trait/Signature]")
int func(const double& a, int&& b) volatile&& noexcept(false);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::false_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::NoexceptVal>);
}
TEST_CASE("const volatile rvalref", "[trait/Signature]")
@@ -393,15 +393,15 @@
TEST_CASE("const volatile rvalref", "[trait/Signature]")
int func(const double& a, int&& b) const volatile&& noexcept(false);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::true_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::NoexceptVal>);
}
TEST_CASE("noexcept rvalref", "[trait/Signature]")
@@ -411,15 +411,15 @@
TEST_CASE("noexcept rvalref", "[trait/Signature]")
int func(const double& a, int&& b) && noexcept(true);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::false_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::NoexceptVal>);
}
TEST_CASE("const noexcept rvalref", "[trait/Signature]")
@@ -429,15 +429,15 @@
TEST_CASE("const noexcept rvalref", "[trait/Signature]")
int func(const double& a, int&& b) const&& noexcept(true);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::true_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::NoexceptVal>);
}
TEST_CASE("volatile noexcept rvalref", "[trait/Signature]")
@@ -447,15 +447,15 @@
TEST_CASE("volatile noexcept rvalref", "[trait/Signature]")
int func(const double& a, int&& b) volatile&& noexcept(true);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::false_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::NoexceptVal>);
}
TEST_CASE("const volatile noexcept rvalref", "[trait/Signature]")
@@ -465,15 +465,15 @@
TEST_CASE("const volatile noexcept rvalref", "[trait/Signature]")
int func(const double& a, int&& b) const volatile&& noexcept(true);
};
using sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), sig::sig_type>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, sig::arg_type>);
STATIC_REQUIRE(SameAs<int, sig::ret_type>);
STATIC_REQUIRE(SameAs<based::true_type, sig::const_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::volatile_val>);
STATIC_REQUIRE(SameAs<based::false_type, sig::lvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::rvalref_val>);
STATIC_REQUIRE(SameAs<based::true_type, sig::noexcept_val>);
using Sig = based::Signature<decltype(&Test::func)>;
STATIC_REQUIRE(SameAs<int(const double&, int&&), Sig::SigType>);
STATIC_REQUIRE(SameAs<std::tuple<const double&, int&&>, Sig::ArgType>);
STATIC_REQUIRE(SameAs<int, Sig::RetType>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::ConstVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::VolatileVal>);
STATIC_REQUIRE(SameAs<based::FalseType, Sig::LvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::RvalrefVal>);
STATIC_REQUIRE(SameAs<based::TrueType, Sig::NoexceptVal>);
}
// NOLINTEND(*cognitive-complexity*)
diff --git a/ test/source/utility/buffer_test.cpp b/ test/source/utility/buffer_test.cpp
@@ -12,30 +12,30 @@
TEST_CASE("valid type", "[utility/buffer]")
{
SECTION("small buffer")
{
using buffer = based::Buffer<sizeof(based::U8)>;
STATIC_REQUIRE(buffer::valid_type<based::U8>());
STATIC_REQUIRE_FALSE(buffer::valid_type<based::size_t>());
using Buffer = based::Buffer<sizeof(based::U8)>;
STATIC_REQUIRE(Buffer::valid_type<based::U8>());
STATIC_REQUIRE_FALSE(Buffer::valid_type<based::SizeT>());
STATIC_REQUIRE_FALSE(buffer::valid_type<char[5]>()); // NOLINT(*array*)
STATIC_REQUIRE_FALSE(Buffer::valid_type<char[5]>()); // NOLINT(*array*)
}
SECTION("big buffer")
{
using buffer = based::Buffer<sizeof(based::size_t), alignof(based::size_t)>;
STATIC_REQUIRE(buffer::valid_type<based::U8>());
STATIC_REQUIRE(buffer::valid_type<based::size_t>());
using Buffer = based::Buffer<sizeof(based::SizeT), alignof(based::SizeT)>;
STATIC_REQUIRE(Buffer::valid_type<based::U8>());
STATIC_REQUIRE(Buffer::valid_type<based::SizeT>());
STATIC_REQUIRE_FALSE(buffer::valid_type<char[5]>()); // NOLINT(*array*)
STATIC_REQUIRE_FALSE(Buffer::valid_type<char[5]>()); // NOLINT(*array*)
}
}
TEST_CASE("buffer", "[utility/buffer]")
{
using namespace based::literals; // NOLINT(*namespace*)
using buffer = based::Buffer<sizeof(based::size_t)>;
using Buffer = based::Buffer<sizeof(based::SizeT)>;
static constexpr auto value = 8_u8;
buffer buf(std::in_place_type<based::U8>, value);
Buffer buf(std::in_place_type<based::U8>, value);
REQUIRE(*buf.as<based::U8>() == value);
@@ -50,7 +50,7 @@
TEST_CASE("buffer", "[utility/buffer]")
SECTION("swap")
{
static constexpr auto new_value = 10_U16;
buffer new_buf(std::in_place_type<based::U16>, new_value);
Buffer new_buf(std::in_place_type<based::U16>, new_value);
buf.swap(new_buf);
REQUIRE(*buf.as<based::U16>() == new_value);
@@ -61,10 +61,10 @@
TEST_CASE("buffer", "[utility/buffer]")
TEST_CASE("const buffer", "[utility/buffer]")
{
using namespace based::literals; // NOLINT(*namespace*)
using buffer = based::Buffer<sizeof(based::size_t)>;
using Buffer = based::Buffer<sizeof(based::SizeT)>;
static constexpr auto value = 8_u8;
const buffer buf(std::in_place_type<based::U8>, value);
const Buffer buf(std::in_place_type<based::U8>, value);
REQUIRE(*buf.as<based::U8>() == value);
}
diff --git a/ test/source/utility/scopeguard_test.cpp b/ test/source/utility/scopeguard_test.cpp
@@ -56,7 +56,7 @@
TEST_CASE("on success", "[utility/scopeguard]")
{
int test = 0;
try {
const based::scopeguard_success guard = Set(test);
const based::ScopeguardSuccess guard = Set(test);
} catch (...) {
test *= 1;
}
@@ -68,7 +68,7 @@
TEST_CASE("on success", "[utility/scopeguard]")
{
int test = 0;
try {
const based::scopeguard_success guard = Set(test);
const based::ScopeguardSuccess guard = Set(test);
throw std::runtime_error {"should not leak"};
} catch (...) {
test *= 1;
@@ -83,7 +83,7 @@
TEST_CASE("on failure", "[utility/scopeguard]")
{
int test = 0;
try {
const based::scopeguard_failure guard = Set(test);
const based::ScopeguardFailure guard = Set(test);
} catch (...) {
test *= 1;
}
@@ -95,7 +95,7 @@
TEST_CASE("on failure", "[utility/scopeguard]")
{
int test = 0;
try {
const based::scopeguard_failure guard = Set(test);
const based::ScopeguardFailure guard = Set(test);
throw std::runtime_error {"should not leak"};
} catch (...) {
REQUIRE(true);
@@ -110,7 +110,7 @@
TEST_CASE("exit", "[utility/scopeguard]")
{
int test = 0;
try {
const based::scopeguard_exit guard = Set(test);
const based::ScopeguardExit guard = Set(test);
} catch (...) {
REQUIRE(false);
}
@@ -122,7 +122,7 @@
TEST_CASE("exit", "[utility/scopeguard]")
{
int test = 0;
try {
const based::scopeguard_exit guard = Set(test);
const based::ScopeguardExit guard = Set(test);
throw std::runtime_error {"should not leak"};
} catch (...) {
test *= 1;