aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/newtype/derivable.hpp32
-rw-r--r--include/newtype/derivation_clause.hpp70
-rw-r--r--include/newtype/deriving.hpp21
-rw-r--r--include/newtype/impl/new_type_iterator_types.hpp66
-rw-r--r--include/newtype/impl/new_type_storage.hpp139
-rw-r--r--include/newtype/impl/type_traits_extensions.hpp853
-rw-r--r--include/newtype/newtype.hpp550
-rw-r--r--include/newtype/version.hpp23
8 files changed, 0 insertions, 1754 deletions
diff --git a/include/newtype/derivable.hpp b/include/newtype/derivable.hpp
deleted file mode 100644
index c798c59..0000000
--- a/include/newtype/derivable.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef NEWTYPE_DERIVABLE_HPP
-#define NEWTYPE_DERIVABLE_HPP
-
-#include "newtype/version.hpp"
-
-namespace nt
-{
-
- template<typename DerivableTag>
- struct derivable final
- {
- using tag_type = DerivableTag;
- };
-
- inline namespace derivables
- {
-
- auto constexpr Arithmetic = derivable<struct arithmetic_tag>{};
- auto constexpr EqBase = derivable<struct eq_base_tag>{};
- auto constexpr Hash = derivable<struct hash_tag>{};
- auto constexpr ImplicitConversion = derivable<struct implicit_conversion_tag>{};
- auto constexpr Indirection = derivable<struct indirection_tag>{};
- auto constexpr Iterable = derivable<struct iterable_tag>{};
- auto constexpr Read = derivable<struct read_tag>{};
- auto constexpr Relational = derivable<struct relational_tag>{};
- auto constexpr Show = derivable<struct show_tag>{};
-
- } // namespace derivables
-
-} // namespace nt
-
-#endif \ No newline at end of file
diff --git a/include/newtype/derivation_clause.hpp b/include/newtype/derivation_clause.hpp
deleted file mode 100644
index 6de70e1..0000000
--- a/include/newtype/derivation_clause.hpp
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef NEWTYPE_DERIVATION_CLAUSE_HPP
-#define NEWTYPE_DERIVATION_CLAUSE_HPP
-
-#include "newtype/derivable.hpp"
-#include "newtype/version.hpp"
-
-#include <type_traits>
-
-namespace nt
-{
-
- template<typename... DerivableTags>
- struct derivation_clause
- {
- constexpr derivation_clause(derivable<DerivableTags>...) noexcept
- {
- }
-
- template<typename DerivableTag>
- auto constexpr operator()(derivable<DerivableTag>) const noexcept -> bool
- {
- return (std::is_same_v<DerivableTags, DerivableTag> || ...);
- }
-
- template<typename DerivableTag, typename... RemainingDerivableTags>
- auto constexpr operator()(derivable<DerivableTag>, derivable<RemainingDerivableTags>...) const noexcept -> bool
- {
- return (*this)(derivable<DerivableTag>{}) && (*this)(derivable<RemainingDerivableTags>{}...);
- }
-
- template<typename... OtherDerivableTags>
- auto constexpr operator<(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool
- {
- return (sizeof...(DerivableTags) < sizeof...(OtherDerivableTags)) && other(derivable<DerivableTags>{}...);
- }
-
- template<typename... OtherDerivableTags>
- auto constexpr operator>(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool
- {
- return other < *this;
- }
-
- template<typename... OtherDerivableTags>
- auto constexpr operator==(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool
- {
- return sizeof...(DerivableTags) == sizeof...(OtherDerivableTags) && other(derivable<DerivableTags>{}...);
- }
-
- template<typename... OtherDerivableTags>
- auto constexpr operator!=(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool
- {
- return !(*this == other);
- }
-
- template<typename... OtherDerivableTags>
- auto constexpr operator<=(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool
- {
- return *this < other || *this == other;
- }
-
- template<typename... OtherDerivableTags>
- auto constexpr operator>=(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool
- {
- return *this > other || *this == other;
- }
- };
-
-} // namespace nt
-
-#endif \ No newline at end of file
diff --git a/include/newtype/deriving.hpp b/include/newtype/deriving.hpp
deleted file mode 100644
index ae10bab..0000000
--- a/include/newtype/deriving.hpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef NEWTYPE_DERIVING_HPP
-#define NEWTYPE_DERIVING_HPP
-
-#include "newtype/derivable.hpp"
-#include "newtype/derivation_clause.hpp"
-#include "newtype/version.hpp"
-
-#include <type_traits>
-
-namespace nt
-{
-
- template<typename... DerivableTags>
- auto constexpr deriving(derivable<DerivableTags>... features) noexcept -> derivation_clause<DerivableTags...>
- {
- return {features...};
- }
-
-} // namespace nt
-
-#endif \ No newline at end of file
diff --git a/include/newtype/impl/new_type_iterator_types.hpp b/include/newtype/impl/new_type_iterator_types.hpp
deleted file mode 100644
index 2ea8274..0000000
--- a/include/newtype/impl/new_type_iterator_types.hpp
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef NEWTYPE_IMPL_NEW_TYPE_ITERATOR_TYPES_HPP
-#define NEWTYPE_IMPL_NEW_TYPE_ITERATOR_TYPES_HPP
-
-#include "newtype/version.hpp"
-
-#include <type_traits>
-
-namespace nt::impl
-{
-
- template<typename T, bool = false, typename = std::void_t<>>
- struct new_type_iterator
- {
- };
-
- template<typename T>
- struct new_type_iterator<T, true, std::void_t<typename T::iterator>>
- {
- using iterator = typename T::iterator;
- };
-
- template<typename T, bool = false, typename = std::void_t<>>
- struct new_type_const_iterator
- {
- };
-
- template<typename T>
- struct new_type_const_iterator<T, true, std::void_t<typename T::const_iterator>>
- {
- using const_iterator = typename T::const_iterator;
- };
-
- template<typename T, bool = false, typename = std::void_t<>>
- struct new_type_reverse_iterator
- {
- };
-
- template<typename T>
- struct new_type_reverse_iterator<T, true, std::void_t<typename T::reverse_iterator>>
- {
- using reverse_iterator = typename T::reverse_iterator;
- };
-
- template<typename T, bool = false, typename = std::void_t<>>
- struct new_type_const_reverse_iterator
- {
- };
-
- template<typename T>
- struct new_type_const_reverse_iterator<T, true, std::void_t<typename T::const_reverse_iterator>>
- {
- using const_reverse_iterator = typename T::const_reverse_iterator;
- };
-
- template<typename T, bool Enabled>
- struct new_type_iterator_types
- : new_type_iterator<T, Enabled>
- , new_type_const_iterator<T, Enabled>
- , new_type_reverse_iterator<T, Enabled>
- , new_type_const_reverse_iterator<T, Enabled>
- {
- };
-
-} // namespace nt::impl
-
-#endif \ No newline at end of file
diff --git a/include/newtype/impl/new_type_storage.hpp b/include/newtype/impl/new_type_storage.hpp
deleted file mode 100644
index f7842af..0000000
--- a/include/newtype/impl/new_type_storage.hpp
+++ /dev/null
@@ -1,139 +0,0 @@
-#ifndef NEWTYPE_IMPL_NEW_TYPE_STORAGE_HPP
-#define NEWTYPE_IMPL_NEW_TYPE_STORAGE_HPP
-
-#include "newtype/version.hpp"
-
-#include <type_traits>
-#include <utility>
-
-namespace nt::impl
-{
-
- template<typename BaseType, typename TagType>
- struct new_type_storage
- {
- constexpr new_type_storage() noexcept(std::is_nothrow_default_constructible_v<BaseType>)
- : m_value{}
- {
- }
-
- constexpr new_type_storage(BaseType const & value)
- : m_value{value}
- {
- }
-
- constexpr new_type_storage(BaseType && value)
- : m_value{std::move(value)}
- {
- }
-
- BaseType m_value;
- };
-
- template<typename BaseType, typename TagType, bool = std::is_default_constructible_v<BaseType>>
- struct new_type_constructor : new_type_storage<BaseType, TagType>
- {
- using new_type_storage<BaseType, TagType>::new_type_storage;
- };
-
- template<typename BaseType, typename TagType>
- struct new_type_constructor<BaseType, TagType, false> : new_type_storage<BaseType, TagType>
- {
- using new_type_storage<BaseType, TagType>::new_type_storage;
-
- constexpr new_type_constructor() = delete;
- };
-
- template<typename BaseType, typename TagType, bool = std::is_copy_constructible_v<BaseType>>
- struct new_type_copy_constructor : new_type_constructor<BaseType, TagType>
- {
- using new_type_constructor<BaseType, TagType>::new_type_constructor;
-
- constexpr new_type_copy_constructor(new_type_copy_constructor const &) = default;
- constexpr new_type_copy_constructor(new_type_copy_constructor &&) = default;
- auto constexpr operator=(new_type_copy_constructor &) -> new_type_copy_constructor & = default;
- auto constexpr operator=(new_type_copy_constructor &&) -> new_type_copy_constructor & = default;
- };
-
- template<typename BaseType, typename TagType>
- struct new_type_copy_constructor<BaseType, TagType, false> : new_type_constructor<BaseType, TagType>
- {
- using new_type_constructor<BaseType, TagType>::new_type_constructor;
-
- constexpr new_type_copy_constructor(new_type_copy_constructor const &) = delete;
- constexpr new_type_copy_constructor(new_type_copy_constructor &&) = default;
- constexpr new_type_copy_constructor(BaseType const &) = delete;
- auto constexpr operator=(new_type_copy_constructor &) -> new_type_copy_constructor & = default;
- auto constexpr operator=(new_type_copy_constructor &&) -> new_type_copy_constructor & = default;
- };
-
- template<typename BaseType, typename TagType, bool = std::is_move_constructible_v<BaseType>>
- struct new_type_move_constructor : new_type_copy_constructor<BaseType, TagType>
- {
- using new_type_copy_constructor<BaseType, TagType>::new_type_copy_constructor;
-
- constexpr new_type_move_constructor(new_type_move_constructor const &) = default;
- constexpr new_type_move_constructor(new_type_move_constructor &&) = default;
- auto constexpr operator=(new_type_move_constructor &) -> new_type_move_constructor & = default;
- auto constexpr operator=(new_type_move_constructor &&) -> new_type_move_constructor & = default;
- };
-
- template<typename BaseType, typename TagType>
- struct new_type_move_constructor<BaseType, TagType, false> : new_type_copy_constructor<BaseType, TagType>
- {
- using new_type_copy_constructor<BaseType, TagType>::new_type_copy_constructor;
-
- constexpr new_type_move_constructor(new_type_move_constructor const &) = default;
- constexpr new_type_move_constructor(new_type_move_constructor &&) = delete;
- constexpr new_type_move_constructor(BaseType &&) = delete;
- auto constexpr operator=(new_type_move_constructor &) -> new_type_move_constructor & = default;
- auto constexpr operator=(new_type_move_constructor &&) -> new_type_move_constructor & = default;
- };
-
- template<typename BaseType, typename TagType, bool = std::is_copy_assignable_v<BaseType>>
- struct new_type_copy_assignment : new_type_move_constructor<BaseType, TagType>
- {
- using new_type_move_constructor<BaseType, TagType>::new_type_move_constructor;
-
- constexpr new_type_copy_assignment(new_type_copy_assignment const &) = default;
- constexpr new_type_copy_assignment(new_type_copy_assignment &&) = default;
- auto constexpr operator=(new_type_copy_assignment &) -> new_type_copy_assignment & = default;
- auto constexpr operator=(new_type_copy_assignment &&) -> new_type_copy_assignment & = default;
- };
-
- template<typename BaseType, typename TagType>
- struct new_type_copy_assignment<BaseType, TagType, false> : new_type_move_constructor<BaseType, TagType>
- {
- using new_type_move_constructor<BaseType, TagType>::new_type_move_constructor;
-
- constexpr new_type_copy_assignment(new_type_copy_assignment const &) = default;
- constexpr new_type_copy_assignment(new_type_copy_assignment &&) = default;
- auto constexpr operator=(new_type_copy_assignment &) -> new_type_copy_assignment & = default;
- auto constexpr operator=(new_type_copy_assignment &&) -> new_type_copy_assignment & = delete;
- };
-
- template<typename BaseType, typename TagType, bool = std::is_move_assignable_v<BaseType>>
- struct new_type_move_assignment : new_type_copy_assignment<BaseType, TagType>
- {
- using new_type_copy_assignment<BaseType, TagType>::new_type_copy_assignment;
-
- constexpr new_type_move_assignment(new_type_move_assignment const &) = default;
- constexpr new_type_move_assignment(new_type_move_assignment &&) = default;
- auto constexpr operator=(new_type_move_assignment &) -> new_type_move_assignment & = default;
- auto constexpr operator=(new_type_move_assignment &&) -> new_type_move_assignment & = default;
- };
-
- template<typename BaseType, typename TagType>
- struct new_type_move_assignment<BaseType, TagType, false> : new_type_copy_assignment<BaseType, TagType>
- {
- using new_type_copy_assignment<BaseType, TagType>::new_type_copy_assignment;
-
- constexpr new_type_move_assignment(new_type_move_assignment const &) = default;
- constexpr new_type_move_assignment(new_type_move_assignment &&) = default;
- auto constexpr operator=(new_type_move_assignment &) -> new_type_move_assignment & = default;
- auto constexpr operator=(new_type_move_assignment &&) -> new_type_move_assignment & = delete;
- };
-
-} // namespace nt::impl
-
-#endif
diff --git a/include/newtype/impl/type_traits_extensions.hpp b/include/newtype/impl/type_traits_extensions.hpp
deleted file mode 100644
index dc41649..0000000
--- a/include/newtype/impl/type_traits_extensions.hpp
+++ /dev/null
@@ -1,853 +0,0 @@
-#ifndef NEWTYPE_IMPL_TYPE_TRAITS_EXTENSIONS_HPP
-#define NEWTYPE_IMPL_TYPE_TRAITS_EXTENSIONS_HPP
-
-#include "newtype/version.hpp"
-
-#include <cstddef>
-#include <functional>
-#include <iosfwd>
-#include <type_traits>
-
-namespace nt::impl
-{
-
- inline namespace equality_comparable
- {
-
- template<typename T, typename = void>
- struct is_equality_comparable : std::false_type
- {
- };
-
- template<typename T>
- struct is_equality_comparable<T, std::void_t<decltype(std::declval<T const &>() == std::declval<T const &>())>> : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_equality_comparable_v = is_equality_comparable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_equality_comparable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_equality_comparable<T, std::void_t<decltype(std::declval<T const &>() == std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T const &>() == std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_equality_comparable_v = is_nothrow_equality_comparable<T>::value;
-
- template<typename T, typename = void>
- struct is_inequality_comparable : std::false_type
- {
- };
-
- template<typename T>
- struct is_inequality_comparable<T, std::void_t<decltype(std::declval<T const &>() != std::declval<T const &>())>> : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_inequality_comparable_v = is_inequality_comparable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_inequality_comparable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_inequality_comparable<T, std::void_t<decltype(std::declval<T const &>() != std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T const &>() != std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_inequality_comparable_v = is_nothrow_inequality_comparable<T>::value;
-
- } // namespace equality_comparable
-
- inline namespace relationally_comparable
- {
-
- template<typename T, typename = void>
- struct is_less_than_comparable : std::false_type
- {
- };
-
- template<typename T>
- struct is_less_than_comparable<T, std::void_t<decltype(std::declval<T const &>() < std::declval<T const &>())>> : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_less_than_comparable_v = is_less_than_comparable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_less_than_comparable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_less_than_comparable<T, std::void_t<decltype(std::declval<T const &>() < std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T const &>() < std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_less_than_comparable_v = is_nothrow_less_than_comparable<T>::value;
-
- template<typename T, typename = void>
- struct is_greater_than_comparable : std::false_type
- {
- };
-
- template<typename T>
- struct is_greater_than_comparable<T, std::void_t<decltype(std::declval<T const &>() > std::declval<T const &>())>> : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_greater_than_comparable_v = is_greater_than_comparable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_greater_than_comparable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_greater_than_comparable<T, std::void_t<decltype(std::declval<T const &>() > std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T const &>() > std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_greater_than_comparable_v = is_nothrow_greater_than_comparable<T>::value;
-
- template<typename T, typename = void>
- struct is_less_than_equal_to_comparable : std::false_type
- {
- };
-
- template<typename T>
- struct is_less_than_equal_to_comparable<T, std::void_t<decltype(std::declval<T const &>() <= std::declval<T const &>())>> : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_less_than_equal_to_comparable_v = is_less_than_equal_to_comparable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_less_than_equal_to_comparable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_less_than_equal_to_comparable<T, std::void_t<decltype(std::declval<T const &>() <= std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T const &>() <= std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_less_than_equal_to_comparable_v = is_nothrow_less_than_equal_to_comparable<T>::value;
-
- template<typename T, typename = void>
- struct is_greater_than_equal_to_comparable : std::false_type
- {
- };
-
- template<typename T>
- struct is_greater_than_equal_to_comparable<T, std::void_t<decltype(std::declval<T const &>() >= std::declval<T const &>())>>
- : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_greater_than_equal_to_comparable_v = is_greater_than_equal_to_comparable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_greater_than_equal_to_comparable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_greater_than_equal_to_comparable<T, std::void_t<decltype(std::declval<T const &>() >= std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T const &>() >= std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_greater_than_equal_to_comparable_v = is_nothrow_greater_than_equal_to_comparable<T>::value;
- } // namespace relationally_comparable
-
- inline namespace iostreamable
- {
-
- template<typename StreamType, typename T, typename = void>
- struct is_output_streamable : std::false_type
- {
- };
-
- template<typename StreamType, typename T>
- struct is_output_streamable<StreamType, T, std::void_t<decltype(std::declval<StreamType &>() << std::declval<T const &>())>>
- : std::true_type
- {
- };
-
- template<typename StreamType, typename T>
- auto constexpr is_output_streamable_v = is_output_streamable<StreamType, T>::value;
-
- template<typename StreamType, typename T, typename = void>
- struct is_nothrow_output_streamable : std::false_type
- {
- };
-
- template<typename StreamType, typename T>
- struct is_nothrow_output_streamable<StreamType, T, std::void_t<decltype(std::declval<StreamType &>() << std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<StreamType &>() << std::declval<T const &>())>
- {
- };
-
- template<typename StreamType, typename T>
- auto constexpr is_nothrow_output_streamable_v = is_nothrow_output_streamable<StreamType, T>::value;
-
- template<typename StreamType, typename T, typename = void>
- struct is_input_streamable : std::false_type
- {
- };
-
- template<typename StreamType, typename T>
- struct is_input_streamable<StreamType, T, std::void_t<decltype(std::declval<StreamType &>() >> std::declval<T &>())>> : std::true_type
- {
- };
-
- template<typename StreamType, typename T>
- auto constexpr is_input_streamable_v = is_input_streamable<StreamType, T>::value;
-
- template<typename StreamType, typename T, typename = void>
- struct is_nothrow_input_streamable : std::false_type
- {
- };
-
- template<typename StreamType, typename T>
- struct is_nothrow_input_streamable<StreamType, T, std::void_t<decltype(std::declval<StreamType &>() >> std::declval<T &>())>>
- : std::bool_constant<noexcept(std::declval<StreamType &>() >> std::declval<T &>())>
- {
- };
-
- template<typename StreamType, typename T>
- auto constexpr is_nothrow_input_streamable_v = is_nothrow_input_streamable<StreamType, T>::value;
-
- } // namespace iostreamable
-
- inline namespace arithmetic
- {
-
- template<typename T, typename = void>
- struct is_addable : std::false_type
- {
- };
-
- template<typename T>
- struct is_addable<T, std::void_t<decltype(std::declval<T const &>() + std::declval<T const &>())>> : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_addable_v = is_addable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_addable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_addable<T, std::void_t<decltype(std::declval<T const &>() + std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T const &>() + std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_addable_v = is_nothrow_addable<T>::value;
-
- template<typename T, typename = void>
- struct is_subtractable : std::false_type
- {
- };
-
- template<typename T>
- struct is_subtractable<T, std::void_t<decltype(std::declval<T const &>() - std::declval<T const &>())>> : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_subtractable_v = is_subtractable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_subtractable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_subtractable<T, std::void_t<decltype(std::declval<T const &>() - std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T const &>() - std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_subtractable_v = is_nothrow_subtractable<T>::value;
-
- template<typename T, typename = void>
- struct is_multipliable : std::false_type
- {
- };
-
- template<typename T>
- struct is_multipliable<T, std::void_t<decltype(std::declval<T const &>() * std::declval<T const &>())>> : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_multipliable_v = is_multipliable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_multipliable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_multipliable<T, std::void_t<decltype(std::declval<T const &>() * std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T const &>() * std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_multipliable_v = is_nothrow_multipliable<T>::value;
-
- template<typename T, typename = void>
- struct is_dividable : std::false_type
- {
- };
-
- template<typename T>
- struct is_dividable<T, std::void_t<decltype(std::declval<T const &>() / std::declval<T const &>())>> : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_dividable_v = is_dividable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_dividable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_dividable<T, std::void_t<decltype(std::declval<T const &>() / std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T const &>() / std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_dividable_v = is_nothrow_dividable<T>::value;
-
- } // namespace arithmetic
-
- inline namespace compound_arithmetic
- {
-
- template<typename T, typename = void>
- struct is_add_assignable : std::false_type
- {
- };
-
- template<typename T>
- struct is_add_assignable<T, std::void_t<decltype(std::declval<T &>() += std::declval<T const &>())>> : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_add_assignable_v = is_add_assignable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_add_assignable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_add_assignable<T, std::void_t<decltype(std::declval<T &>() += std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T &>() += std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_add_assignable_v = is_nothrow_add_assignable<T>::value;
-
- template<typename T, typename = void>
- struct is_subtract_assignable : std::false_type
- {
- };
-
- template<typename T>
- struct is_subtract_assignable<T, std::void_t<decltype(std::declval<T &>() -= std::declval<T const &>())>> : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_subtract_assignable_v = is_subtract_assignable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_subtract_assignable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_subtract_assignable<T, std::void_t<decltype(std::declval<T &>() -= std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T &>() -= std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_subtract_assignable_v = is_nothrow_subtract_assignable<T>::value;
-
- template<typename T, typename = void>
- struct is_multiply_assignable : std::false_type
- {
- };
-
- template<typename T>
- struct is_multiply_assignable<T, std::void_t<decltype(std::declval<T &>() *= std::declval<T const &>())>> : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_multiply_assignable_v = is_multiply_assignable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_multiply_assignable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_multiply_assignable<T, std::void_t<decltype(std::declval<T &>() *= std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T &>() *= std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_multiply_assignable_v = is_nothrow_multiply_assignable<T>::value;
-
- template<typename T, typename = void>
- struct is_divide_assignable : std::false_type
- {
- };
-
- template<typename T>
- struct is_divide_assignable<T, std::void_t<decltype(std::declval<T &>() /= std::declval<T const &>())>> : std::true_type
- {
- };
-
- template<typename T>
- auto constexpr is_divide_assignable_v = is_divide_assignable<T>::value;
-
- template<typename T, typename = void>
- struct is_nothrow_divide_assignable : std::false_type
- {
- };
-
- template<typename T>
- struct is_nothrow_divide_assignable<T, std::void_t<decltype(std::declval<T &>() /= std::declval<T const &>())>>
- : std::bool_constant<noexcept(std::declval<T &>() /= std::declval<T const &>())>
- {
- };
-
- template<typename T>
- auto constexpr is_nothrow_divide_assignable_v = is_nothrow_divide_assignable<T>::value;
-
- } // namespace compound_arithmetic
-
- inline namespace std_support
- {
-
- template<typename T, typename = void>
- struct is_hashable : std::false_type
- {
- };
-
- template<typename T>
- struct is_hashable<T, std::void_t<decltype(std::declval<std::hash<T> const &>()(std::declval<T const &>()))>>
- : std::is_same<std::size_t, decltype(std::declval<std::hash<T> const &>()(std::declval<T const &>()))>
- {
- };
-
- template<typename T>
- auto constexpr is_hashable_v = is_hashable<T>::value;
-
- } // namespace std_support
-
- inline namespace iterable_begin
- {
- template<typename T, typename = void>
- struct has_free_begin : std::false_type
- {
- };
-
- template<typename T>
- struct has_free_begin<T, std::void_t<decltype(begin(std::declval<T &>()))>>
- : std::is_same<typename T::iterator, std::remove_cvref_t<decltype(begin(std::declval<T &>()))>>
- {
- };
-
- template<typename T>
- struct has_free_begin<T const, std::void_t<decltype(begin(std::declval<T const &>()))>>
- : std::is_same<typename T::const_iterator, std::remove_cvref_t<decltype(begin(std::declval<T const &>()))>>
- {
- };
-
- template<typename T>
- auto constexpr has_free_begin_v = has_free_begin<T>::value;
-
- template<typename T, typename = void>
- struct has_member_begin : std::false_type
- {
- };
-
- template<typename T>
- struct has_member_begin<T, std::void_t<decltype(std::declval<T &>().begin())>>
- : std::is_same<typename T::iterator, std::remove_cvref_t<decltype(std::declval<T &>().begin())>>
- {
- };
-
- template<typename T>
- struct has_member_begin<T const, std::void_t<decltype(std::declval<T const &>().begin())>>
- : std::is_same<typename T::const_iterator, std::remove_cvref_t<decltype(std::declval<T const &>().begin())>>
- {
- };
-
- template<typename T>
- auto constexpr has_member_begin_v = has_member_begin<T>::value;
-
- template<typename T>
- struct has_begin : std::disjunction<has_free_begin<T>, has_member_begin<T>>
- {
- };
-
- template<typename T>
- auto constexpr has_begin_v = has_begin<T>::value;
- } // namespace iterable_begin
-
- inline namespace iterable_cbegin
- {
- template<typename T, typename = void>
- struct has_free_cbegin : std::false_type
- {
- };
-
- template<typename T>
- struct has_free_cbegin<T, std::void_t<decltype(cbegin(std::declval<T const &>()))>>
- : std::is_same<typename T::const_iterator, std::remove_cvref_t<decltype(cbegin(std::declval<T const &>()))>>
- {
- };
-
- template<typename T>
- auto constexpr has_free_cbegin_v = has_free_cbegin<T>::value;
-
- template<typename T, typename = void>
- struct has_member_cbegin : std::false_type
- {
- };
-
- template<typename T>
- struct has_member_cbegin<T, std::void_t<decltype(std::declval<T const &>().cbegin())>>
- : std::is_same<typename T::const_iterator, decltype(std::declval<T const &>().cbegin())>
- {
- };
-
- template<typename T>
- auto constexpr has_member_cbegin_v = has_member_cbegin<T>::value;
-
- template<typename T>
- struct has_cbegin : std::disjunction<has_free_cbegin<T>, has_member_cbegin<T>>
- {
- };
-
- template<typename T>
- auto constexpr has_cbegin_v = has_cbegin<T>::value;
- } // namespace iterable_cbegin
-
- inline namespace iterable_rbegin
- {
- template<typename T, typename = void>
- struct has_free_rbegin : std::false_type
- {
- };
-
- template<typename T>
- struct has_free_rbegin<T, std::void_t<decltype(rbegin(std::declval<T &>()))>>
- : std::is_same<typename T::reverse_iterat