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_iterator, std::remove_cvref_t<decltype(rbegin(std::declval<T &>()))>>
- {
- };
-
- template<typename T>
- struct has_free_rbegin<T const, std::void_t<decltype(rbegin(std::declval<T const &>()))>>
- : std::is_same<typename T::const_reverse_iterator, std::remove_cvref_t<decltype(rbegin(std::declval<T const &>()))>>
- {
- };
-
- template<typename T>
- auto constexpr has_free_rbegin_v = has_free_rbegin<T>::value;
-
- template<typename T, typename = void>
- struct has_member_rbegin : std::false_type
- {
- };
-
- template<typename T>
- struct has_member_rbegin<T, std::void_t<decltype(std::declval<T &>().rbegin())>>
- : std::is_same<typename T::reverse_iterator, std::remove_cvref_t<decltype(std::declval<T &>().rbegin())>>
- {
- };
-
- template<typename T>
- struct has_member_rbegin<T const, std::void_t<decltype(std::declval<T const &>().rbegin())>>
- : std::is_same<typename T::const_reverse_iterator, std::remove_cvref_t<decltype(std::declval<T const &>().rbegin())>>
- {
- };
-
- template<typename T>
- auto constexpr has_member_rbegin_v = has_member_rbegin<T>::value;
-
- template<typename T>
- struct has_rbegin : std::disjunction<has_free_rbegin<T>, has_member_rbegin<T>>
- {
- };
-
- template<typename T>
- auto constexpr has_rbegin_v = has_rbegin<T>::value;
- } // namespace iterable_rbegin
-
- inline namespace iterable_crbegin
- {
- template<typename T, typename = void>
- struct has_free_crbegin : std::false_type
- {
- };
-
- template<typename T>
- struct has_free_crbegin<T, std::void_t<decltype(crbegin(std::declval<T const &>()))>>
- : std::is_same<typename T::const_reverse_iterator, std::remove_cvref_t<decltype(crbegin(std::declval<T const &>()))>>
- {
- };
-
- template<typename T>
- auto constexpr has_free_crbegin_v = has_free_crbegin<T>::value;
-
- template<typename T, typename = void>
- struct has_member_crbegin : std::false_type
- {
- };
-
- template<typename T>
- struct has_member_crbegin<T, std::void_t<decltype(std::declval<T const &>().crbegin())>>
- : std::is_same<typename T::const_reverse_iterator, std::remove_cvref_t<decltype(std::declval<T const &>().crbegin())>>
- {
- };
-
- template<typename T>
- auto constexpr has_member_crbegin_v = has_member_crbegin<T>::value;
-
- template<typename T>
- struct has_crbegin : std::disjunction<has_free_crbegin<T>, has_member_crbegin<T>>
- {
- };
-
- template<typename T>
- auto constexpr has_crbegin_v = has_crbegin<T>::value;
- } // namespace iterable_crbegin
-
- inline namespace iterable_end
- {
- template<typename T, typename = void>
- struct has_free_end : std::false_type
- {
- };
-
- template<typename T>
- struct has_free_end<T, std::void_t<decltype(end(std::declval<T &>()))>>
- : std::is_same<typename T::iterator, std::remove_cvref_t<decltype(end(std::declval<T &>()))>>
- {
- };
-
- template<typename T>
- struct has_free_end<T const, std::void_t<decltype(end(std::declval<T const &>()))>>
- : std::is_same<typename T::const_iterator, std::remove_cvref_t<decltype(end(std::declval<T const &>()))>>
- {
- };
-
- template<typename T>
- auto constexpr has_free_end_v = has_free_end<T>::value;
-
- template<typename T, typename = void>
- struct has_member_end : std::false_type
- {
- };
-
- template<typename T>
- struct has_member_end<T, std::void_t<decltype(std::declval<T &>().end())>>
- : std::is_same<typename T::iterator, std::remove_cvref_t<decltype(std::declval<T &>().end())>>
- {
- };
-
- template<typename T>
- struct has_member_end<T const, std::void_t<decltype(std::declval<T const &>().end())>>
- : std::is_same<typename T::const_iterator, std::remove_cvref_t<decltype(std::declval<T const &>().end())>>
- {
- };
-
- template<typename T>
- auto constexpr has_member_end_v = has_member_end<T>::value;
-
- template<typename T>
- struct has_end : std::disjunction<has_free_end<T>, has_member_end<T>>
- {
- };
-
- template<typename T>
- auto constexpr has_end_v = has_end<T>::value;
- } // namespace iterable_end
-
- inline namespace iterable_cend
- {
- template<typename T, typename = void>
- struct has_free_cend : std::false_type
- {
- };
-
- template<typename T>
- struct has_free_cend<T, std::void_t<decltype(cend(std::declval<T const &>()))>>
- : std::is_same<typename T::const_iterator, std::remove_cvref_t<decltype(cend(std::declval<T const &>()))>>
- {
- };
-
- template<typename T>
- auto constexpr has_free_cend_v = has_free_cend<T>::value;
-
- template<typename T, typename = void>
- struct has_member_cend : std::false_type
- {
- };
-
- template<typename T>
- struct has_member_cend<T, std::void_t<decltype(std::declval<T const &>().cend())>>
- : std::is_same<typename T::const_iterator, decltype(std::declval<T const &>().cend())>
- {
- };
-
- template<typename T>
- auto constexpr has_member_cend_v = has_member_cend<T>::value;
-
- template<typename T>
- struct has_cend : std::disjunction<has_free_cend<T>, has_member_cend<T>>
- {
- };
-
- template<typename T>
- auto constexpr has_cend_v = has_cend<T>::value;
- } // namespace iterable_cend
-
- inline namespace iterable_rend
- {
- template<typename T, typename = void>
- struct has_free_rend : std::false_type
- {
- };
-
- template<typename T>
- struct has_free_rend<T, std::void_t<decltype(rend(std::declval<T &>()))>>
- : std::is_same<typename T::reverse_iterator, std::remove_cvref_t<decltype(rend(std::declval<T &>()))>>
- {
- };
-
- template<typename T>
- struct has_free_rend<T const, std::void_t<decltype(rend(std::declval<T const &>()))>>
- : std::is_same<typename T::const_reverse_iterator, std::remove_cvref_t<decltype(rend(std::declval<T const &>()))>>
- {
- };
-
- template<typename T>
- auto constexpr has_free_rend_v = has_free_rend<T>::value;
-
- template<typename T, typename = void>
- struct has_member_rend : std::false_type
- {
- };
-
- template<typename T>
- struct has_member_rend<T, std::void_t<decltype(std::declval<T &>().rend())>>
- : std::is_same<typename T::reverse_iterator, std::remove_cvref_t<decltype(std::declval<T &>().rend())>>
- {
- };
-
- template<typename T>
- struct has_member_rend<T const, std::void_t<decltype(std::declval<T const &>().rend())>>
- : std::is_same<typename T::const_reverse_iterator, std::remove_cvref_t<decltype(std::declval<T const &>().rend())>>
- {
- };
-
- template<typename T>
- auto constexpr has_member_rend_v = has_member_rend<T>::value;
-
- template<typename T>
- struct has_rend : std::disjunction<has_free_rend<T>, has_member_rend<T>>
- {
- };
-
- template<typename T>
- auto constexpr has_rend_v = has_rend<T>::value;
- } // namespace iterable_rend
-
- inline namespace iterable_crend
- {
- template<typename T, typename = void>
- struct has_free_crend : std::false_type
- {
- };
-
- template<typename T>
- struct has_free_crend<T, std::void_t<decltype(crend(std::declval<T const &>()))>>
- : std::is_same<typename T::const_reverse_iterator, std::remove_cvref_t<decltype(crend(std::declval<T const &>()))>>
- {
- };
-
- template<typename T>
- auto constexpr has_free_crend_v = has_free_crend<T>::value;
-
- template<typename T, typename = void>
- struct has_member_crend : std::false_type
- {
- };
-
- template<typename T>
- struct has_member_crend<T, std::void_t<decltype(std::declval<T const &>().crend())>>
- : std::is_same<typename T::const_reverse_iterator, std::remove_cvref_t<decltype(std::declval<T const &>().crend())>>
- {
- };
-
- template<typename T>
- auto constexpr has_member_crend_v = has_member_crend<T>::value;
-
- template<typename T>
- struct has_crend : std::disjunction<has_free_crend<T>, has_member_crend<T>>
- {
- };
-
- template<typename T>
- auto constexpr has_crend_v = has_crend<T>::value;
- } // namespace iterable_crend
-
-} // namespace nt::impl
-
-#endif \ No newline at end of file
diff --git a/include/newtype/newtype.hpp b/include/newtype/newtype.hpp
deleted file mode 100644
index e2704f3..0000000
--- a/include/newtype/newtype.hpp
+++ /dev/null
@@ -1,550 +0,0 @@
-#ifndef NEWTYPE_NEWTYPE_HPP
-#define NEWTYPE_NEWTYPE_HPP
-
-#include "newtype/derivable.hpp"
-#include "newtype/deriving.hpp"
-#include "newtype/impl/new_type_iterator_types.hpp"
-#include "newtype/impl/new_type_storage.hpp"
-#include "newtype/impl/type_traits_extensions.hpp"
-#include "newtype/version.hpp"
-
-#include <functional>
-#include <istream>
-#include <ostream>
-#include <type_traits>
-
-namespace nt
-{
-
- template<typename BaseType, typename TagType, auto DerivationClause = deriving()>
- class new_type
- : impl::new_type_move_assignment<BaseType, TagType>
- , public impl::new_type_iterator_types<BaseType, DerivationClause(nt::Iterable)>
- {
- static_assert(!std::is_reference_v<BaseType>, "The base type must not be a reference type");
- static_assert(!std::is_void_v<std::remove_cv_t<BaseType>>, "The base type must not be possibly cv-qualified void");
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV, typename CharType, typename StreamTraits>
- auto friend operator>>(std::basic_istream<CharType, StreamTraits> &, new_type<BaseTypeT, TagTypeT, DerivationClauseV> &) noexcept(
- impl::is_nothrow_input_streamable_v<std::basic_istream<CharType, StreamTraits>, BaseTypeT>)
- -> std::enable_if_t<DerivationClauseV(nt::Read) && impl::is_input_streamable_v<std::basic_istream<CharType, StreamTraits>, BaseTypeT>,
- std::basic_istream<CharType, StreamTraits>> &;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend
- operator+=(new_type<BaseTypeT, TagTypeT, DerivationClauseV> & lhs,
- new_type<BaseTypeT, TagTypeT, DerivationClauseV> const & rhs) noexcept(impl::is_nothrow_add_assignable_v<BaseTypeT>)
- -> std::enable_if_t<DerivationClauseV(nt::Arithmetic) && impl::is_add_assignable_v<BaseTypeT>,
- new_type<BaseTypeT, TagTypeT, DerivationClauseV> &>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend
- operator-=(new_type<BaseTypeT, TagTypeT, DerivationClauseV> & lhs,
- new_type<BaseTypeT, TagTypeT, DerivationClauseV> const & rhs) noexcept(impl::is_nothrow_subtract_assignable_v<BaseTypeT>)
- -> std::enable_if_t<DerivationClauseV(nt::Arithmetic) && impl::is_subtract_assignable_v<BaseTypeT>,
- new_type<BaseTypeT, TagTypeT, DerivationClauseV> &>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend
- operator*=(new_type<BaseTypeT, TagTypeT, DerivationClauseV> & lhs,
- new_type<BaseTypeT, TagTypeT, DerivationClauseV> const & rhs) noexcept(impl::is_nothrow_multiply_assignable_v<BaseTypeT>)
- -> std::enable_if_t<DerivationClauseV(nt::Arithmetic) && impl::is_multiply_assignable_v<BaseTypeT>,
- new_type<BaseTypeT, TagTypeT, DerivationClauseV> &>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend
- operator/=(new_type<BaseTypeT, TagTypeT, DerivationClauseV> & lhs,
- new_type<BaseTypeT, TagTypeT, DerivationClauseV> const & rhs) noexcept(impl::is_nothrow_divide_assignable_v<BaseTypeT>)
- -> std::enable_if_t<DerivationClauseV(nt::Arithmetic) && impl::is_divide_assignable_v<BaseTypeT>,
- new_type<BaseTypeT, TagTypeT, DerivationClauseV> &>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend begin(new_type<BaseTypeT, TagTypeT, DerivationClauseV> & obj)
- -> std::enable_if_t<DerivationClauseV(nt::Iterable) && impl::has_free_begin_v<BaseTypeT>,
- typename new_type<BaseTypeT, TagTypeT, DerivationClauseV>::iterator>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend begin(new_type<BaseTypeT, TagTypeT, DerivationClauseV> const & obj)
- -> std::enable_if_t<DerivationClauseV(nt::Iterable) && impl::has_free_begin_v<BaseTypeT const>,
- typename new_type<BaseTypeT, TagTypeT, DerivationClauseV>::const_iterator>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend cbegin(new_type<BaseTypeT, TagTypeT, DerivationClauseV> const & obj)
- -> std::enable_if_t<DerivationClauseV(nt::Iterable) && impl::has_free_cbegin_v<BaseTypeT const>,
- typename new_type<BaseTypeT, TagTypeT, DerivationClauseV>::const_iterator>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend rbegin(new_type<BaseTypeT, TagTypeT, DerivationClauseV> & obj)
- -> std::enable_if_t<DerivationClauseV(nt::Iterable) && impl::has_free_rbegin_v<BaseTypeT>,
- typename new_type<BaseTypeT, TagTypeT, DerivationClauseV>::reverse_iterator>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend rbegin(new_type<BaseTypeT, TagTypeT, DerivationClauseV> const & obj)
- -> std::enable_if_t<DerivationClauseV(nt::Iterable) && impl::has_free_rbegin_v<BaseTypeT const>,
- typename new_type<BaseTypeT, TagTypeT, DerivationClauseV>::const_reverse_iterator>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend crbegin(new_type<BaseTypeT, TagTypeT, DerivationClauseV> const & obj)
- -> std::enable_if_t<DerivationClauseV(nt::Iterable) && impl::has_free_crbegin_v<BaseTypeT const>,
- typename new_type<BaseTypeT, TagTypeT, DerivationClauseV>::const_reverse_iterator>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend end(new_type<BaseTypeT, TagTypeT, DerivationClauseV> & obj)
- -> std::enable_if_t<DerivationClauseV(nt::Iterable) && impl::has_free_end_v<BaseTypeT>,
- typename new_type<BaseTypeT, TagTypeT, DerivationClauseV>::iterator>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend end(new_type<BaseTypeT, TagTypeT, DerivationClauseV> const & obj)
- -> std::enable_if_t<DerivationClauseV(nt::Iterable) && impl::has_free_end_v<BaseTypeT const>,
- typename new_type<BaseTypeT, TagTypeT, DerivationClauseV>::const_iterator>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend cend(new_type<BaseTypeT, TagTypeT, DerivationClauseV> const & obj)
- -> std::enable_if_t<DerivationClauseV(nt::Iterable) && impl::has_free_cend_v<BaseTypeT const>,
- typename new_type<BaseTypeT, TagTypeT, DerivationClauseV>::const_iterator>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend rend(new_type<BaseTypeT, TagTypeT, DerivationClauseV> & obj)
- -> std::enable_if_t<DerivationClauseV(nt::Iterable) && impl::has_free_rend_v<BaseTypeT>,
- typename new_type<BaseTypeT, TagTypeT, DerivationClauseV>::reverse_iterator>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend rend(new_type<BaseTypeT, TagTypeT, DerivationClauseV> const & obj)
- -> std::enable_if_t<DerivationClauseV(nt::Iterable) && impl::has_free_rend_v<BaseTypeT const>,
- typename new_type<BaseTypeT, TagTypeT, DerivationClauseV>::const_reverse_iterator>;
-
- template<typename BaseTypeT, typename TagTypeT, auto DerivationClauseV>
- auto constexpr friend crend(new_type<BaseTypeT, TagTypeT, DerivationClauseV> const & obj)
- -> std::enable_if_t<DerivationClauseV(nt::Iterable) && impl::has_free_crend_v<BaseTypeT const>,
- typename new_type<BaseTypeT, TagTypeT, DerivationClauseV>::const_reverse_iterator>;
-
- using super = impl::new_type_move_assignment<BaseType, TagType>;
-
- public:
- using base_type = BaseType;
- using tag_type = TagType;
- using derivation_clause_type = decltype(DerivationClause);
-
- auto constexpr static derivation_clause = DerivationClause;
-
- using super::super;
-
- constexpr new_type() noexcept(std::is_nothrow_default_constructible_v<BaseType>) = default;
- constexpr new_type(new_type const &) noexcept(std::is_nothrow_copy_constructible_v<BaseType>) = default;
- constexpr new_type(new_type &&) noexcept(std::is_nothrow_move_constructible_v<BaseType>) = default;
-
- auto constexpr operator=(new_type const &) noexcept(std::is_nothrow_copy_assignable_v<BaseType>) -> new_type & = default;
- auto constexpr operator=(new_type &&) noexcept(std::is_nothrow_move_assignable_v<BaseType>) -> new_type & = default;
-
- auto constexpr decay() const noexcept(std::is_nothrow_copy_constructible_v<BaseType>) -> BaseType
- {
- return this->m_value;
- }
-
- template<typename NewType = new_type, std::enable_if_t<NewType::derivation_clause(nt::ImplicitConversion)> * = nullptr>
- constexpr operator base_type() const noexcept(std::is_nothrow_copy_constructible_v<base_type>)
- {
- return decay();
- }
-
- template<typename NewType = new_type, std::enable_if_t<!NewType::derivation_clause(nt::ImplicitConversion)> * = nullptr>
- explicit constexpr operator base_type() const noexcept(std::is_nothrow_copy_constructible_v<base_type>)
- {
- return decay();
- }
-
- template<typename NewType = new_type>
- auto constexpr operator->() noexcept -> std::enable_if_t<NewType::derivation_clause(nt::Indirection), BaseType *>
- {
- return std::addressof(this->m_value);
- }
-
- template<typename NewType = new_type>
- auto constexpr operator->() const noexcept -> std::enable_if_t<NewType::derivation_clause(nt::Indirection), BaseType const *>
- {
- return std::addressof(this->m_value);
- }
-
- template<typename NewType = new_type, std::enable_if_t<NewType::derivation_clause(nt::Iterable)> * = nullptr>
- auto constexpr begin()
- -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_begin_v<BaseType>, typename NewType::iterator>
- {
- return this->m_value.begin();
- }
-
- template<typename NewType = new_type>
- auto constexpr begin() const -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_begin_v<BaseType const>,
- typename NewType::const_iterator>
- {
- return this->m_value.begin();
- }
-
- template<typename NewType = new_type>
- auto constexpr cbegin() const -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_cbegin_v<BaseType const>,
- typename NewType::const_iterator>
- {
- return this->m_value.cbegin();
- }
-
- template<typename NewType = new_type, std::enable_if_t<NewType::derivation_clause(nt::Iterable)> * = nullptr>
- auto constexpr rbegin()
- -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_rbegin_v<BaseType>, typename NewType::reverse_iterator>
- {
- return this->m_value.rbegin();
- }
-
- template<typename NewType = new_type>
- auto constexpr rbegin() const -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_rbegin_v<BaseType const>,
- typename NewType::const_reverse_iterator>
- {
- return this->m_value.rbegin();
- }
-
- template<typename NewType = new_type>
- auto constexpr crbegin() const -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_crbegin_v<BaseType const>,
- typename NewType::const_reverse_iterator>
- {
- return this->m_value.crbegin();
- }
-
- template<typename NewType = new_type, std::enable_if_t<NewType::derivation_clause(nt::Iterable)> * = nullptr>
- auto constexpr end()
- -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_end_v<BaseType>, typename NewType::iterator>
- {
- return this->m_value.end();
- }
-
- template<typename NewType = new_type>
- auto constexpr end() const -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_end_v<BaseType const>,
- typename NewType::const_iterator>
- {
- return this->m_value.end();
- }
-
- template<typename NewType = new_type>
- auto constexpr cend() const -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_cend_v<BaseType const>,
- typename NewType::const_iterator>
- {
- return this->m_value.cend();
- }
-
- template<typename NewType = new_type, std::enable_if_t<NewType::derivation_clause(nt::Iterable)> * = nullptr>
- auto constexpr rend()
- -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_rend_v<BaseType>, typename NewType::reverse_iterator>
- {
- return this->m_value.rend();
- }
-
- template<typename NewType = new_type>
- auto constexpr rend() const -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_rend_v<BaseType const>,
- typename NewType::const_reverse_iterator>
- {
- return this->m_value.rend();
- }
-
- template<typename NewType = new_type>
- auto constexpr crend() const -> std::enable_if_t<NewType::derivation_clause(nt::Iterable) && impl::has_member_crend_v<BaseType const>,
- typename NewType::const_reverse_iterator>
- {
- return this->m_value.crend();
- }
- };
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator==(new_type<BaseType, TagType, DerivationClause> const & lhs,
- new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(impl::is_nothrow_equality_comparable_v<BaseType>)
- -> std::enable_if_t<impl::is_equality_comparable_v<BaseType>, bool>
- {
- return lhs.decay() == rhs.decay();
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr operator==(new_type<BaseType, TagType, DerivationClause> const & lhs,
- BaseType const & rhs) noexcept(impl::is_nothrow_equality_comparable_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::EqBase) && impl::is_equality_comparable_v<BaseType>, bool>
- {
- return lhs.decay() == rhs;
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator==(BaseType const & lhs,
- new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(impl::is_nothrow_equality_comparable_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::EqBase) && impl::is_equality_comparable_v<BaseType>, bool>
- {
- return lhs == rhs.decay();
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator!=(new_type<BaseType, TagType, DerivationClause> const & lhs,
- new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(impl::is_nothrow_inequality_comparable_v<BaseType>)
- -> std::enable_if_t<impl::is_inequality_comparable_v<BaseType>, bool>
- {
- return lhs.decay() != rhs.decay();
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr operator!=(new_type<BaseType, TagType, DerivationClause> const & lhs,
- BaseType const & rhs) noexcept(impl::is_nothrow_inequality_comparable_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::EqBase) && impl::is_inequality_comparable_v<BaseType>, bool>
- {
- return lhs.decay() != rhs;
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator!=(BaseType const & lhs,
- new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(impl::is_nothrow_inequality_comparable_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::EqBase) && impl::is_inequality_comparable_v<BaseType>, bool>
- {
- return lhs != rhs.decay();
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator<(new_type<BaseType, TagType, DerivationClause> const & lhs,
- new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(impl::is_nothrow_less_than_comparable_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Relational) && impl::is_less_than_comparable_v<BaseType>, bool>
- {
- return lhs.decay() < rhs.decay();
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator>(new_type<BaseType, TagType, DerivationClause> const & lhs,
- new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(impl::is_nothrow_greater_than_comparable_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Relational) && impl::is_greater_than_comparable_v<BaseType>, bool>
- {
- return lhs.decay() > rhs.decay();
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator<=(new_type<BaseType, TagType, DerivationClause> const & lhs,
- new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(impl::is_nothrow_less_than_equal_to_comparable_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Relational) && impl::is_less_than_equal_to_comparable_v<BaseType>, bool>
- {
- return lhs.decay() <= rhs.decay();
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator>=(new_type<BaseType, TagType, DerivationClause> const & lhs,
- new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(impl::is_nothrow_greater_than_equal_to_comparable_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Relational) && impl::is_greater_than_equal_to_comparable_v<BaseType>, bool>
- {
- return lhs.decay() >= rhs.decay();
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause, typename CharType, typename StreamTraits>
- auto operator<<(std::basic_ostream<CharType, StreamTraits> & output, new_type<BaseType, TagType, DerivationClause> const & source) noexcept(
- impl::is_nothrow_output_streamable_v<std::basic_ostream<CharType, StreamTraits>, BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Show) && impl::is_output_streamable_v<std::basic_ostream<CharType, StreamTraits>, BaseType>,
- std::basic_ostream<CharType, StreamTraits>> &
- {
- return output << source.decay();
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause, typename CharType, typename StreamTraits>
- auto operator>>(std::basic_istream<CharType, StreamTraits> & input, new_type<BaseType, TagType, DerivationClause> & target) noexcept(
- impl::is_nothrow_input_streamable_v<std::basic_istream<CharType, StreamTraits>, BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Read) && impl::is_input_streamable_v<std::basic_istream<CharType, StreamTraits>, BaseType>,
- std::basic_istream<CharType, StreamTraits>> &
- {
- return input >> target.m_value;
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator+(new_type<BaseType, TagType, DerivationClause> const & lhs, new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(
- impl::is_nothrow_addable_v<BaseType> && std::is_nothrow_copy_constructible_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Arithmetic) && impl::is_addable_v<BaseType>, new_type<BaseType, TagType, DerivationClause>>
- {
- return {lhs.decay() + rhs.decay()};
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr operator+=(new_type<BaseType, TagType, DerivationClause> & lhs,
- new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(impl::is_nothrow_add_assignable_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Arithmetic) && impl::is_add_assignable_v<BaseType>,
- new_type<BaseType, TagType, DerivationClause> &>
- {
- lhs.m_value += rhs.m_value;
- return lhs;
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator-(new_type<BaseType, TagType, DerivationClause> const & lhs, new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(
- impl::is_nothrow_subtractable_v<BaseType> && std::is_nothrow_copy_constructible_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Arithmetic) && impl::is_subtractable_v<BaseType>, new_type<BaseType, TagType, DerivationClause>>
- {
- return {lhs.decay() - rhs.decay()};
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator-=(new_type<BaseType, TagType, DerivationClause> & lhs,
- new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(impl::is_nothrow_subtract_assignable_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Arithmetic) && impl::is_subtract_assignable_v<BaseType>,
- new_type<BaseType, TagType, DerivationClause> &>
- {
- lhs.m_value -= rhs.m_value;
- return lhs;
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator*(new_type<BaseType, TagType, DerivationClause> const & lhs, new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(
- impl::is_nothrow_multipliable_v<BaseType> && std::is_nothrow_copy_constructible_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Arithmetic) && impl::is_multipliable_v<BaseType>, new_type<BaseType, TagType, DerivationClause>>
- {
- return {lhs.decay() * rhs.decay()};
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator*=(new_type<BaseType, TagType, DerivationClause> & lhs,
- new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(impl::is_nothrow_multiply_assignable_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Arithmetic) && impl::is_multiply_assignable_v<BaseType>,
- new_type<BaseType, TagType, DerivationClause> &>
- {
- lhs.m_value *= rhs.m_value;
- return lhs;
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr
- operator/(new_type<BaseType, TagType, DerivationClause> const & lhs, new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(
- impl::is_nothrow_dividable_v<BaseType> && std::is_nothrow_copy_constructible_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Arithmetic) && impl::is_dividable_v<BaseType>, new_type<BaseType, TagType, DerivationClause>>
- {
- return {lhs.decay() / rhs.decay()};
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr operator/=(new_type<BaseType, TagType, DerivationClause> & lhs,
- new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(impl::is_nothrow_divide_assignable_v<BaseType>)
- -> std::enable_if_t<DerivationClause(nt::Arithmetic) && impl::is_divide_assignable_v<BaseType>,
- new_type<BaseType, TagType, DerivationClause> &>
- {
- lhs.m_value /= rhs.m_value;
- return lhs;
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr begin(new_type<BaseType, TagType, DerivationClause> & obj)
- -> std::enable_if_t<DerivationClause(nt::Iterable) && impl::has_free_begin_v<BaseType>,
- typename new_type<BaseType, TagType, DerivationClause>::iterator>
- {
- return begin(obj.m_value);
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr begin(new_type<BaseType, TagType, DerivationClause> const & obj)
- -> std::enable_if_t<DerivationClause(nt::Iterable) && impl::has_free_begin_v<BaseType const>,
- typename new_type<BaseType, TagType, DerivationClause>::const_iterator>
- {
- return begin(obj.m_value);
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr cbegin(new_type<BaseType, TagType, DerivationClause> const & obj)
- -> std::enable_if_t<DerivationClause(nt::Iterable) && impl::has_free_cbegin_v<BaseType const>,
- typename new_type<BaseType, TagType, DerivationClause>::const_iterator>
- {
- return cbegin(obj.m_value);
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr rbegin(new_type<BaseType, TagType, DerivationClause> & obj)
- -> std::enable_if_t<DerivationClause(nt::Iterable) && impl::has_free_rbegin_v<BaseType>,
- typename new_type<BaseType, TagType, DerivationClause>::reverse_iterator>
- {
- return rbegin(obj.m_value);
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr rbegin(new_type<BaseType, TagType, DerivationClause> const & obj)
- -> std::enable_if_t<DerivationClause(nt::Iterable) && impl::has_free_rbegin_v<BaseType const>,
- typename new_type<BaseType, TagType, DerivationClause>::const_reverse_iterator>
- {
- return rbegin(obj.m_value);
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr crbegin(new_type<BaseType, TagType, DerivationClause> const & obj)
- -> std::enable_if_t<DerivationClause(nt::Iterable) && impl::has_free_crbegin_v<BaseType const>,
- typename new_type<BaseType, TagType, DerivationClause>::const_reverse_iterator>
- {
- return crbegin(obj.m_value);
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr end(new_type<BaseType, TagType, DerivationClause> & obj)
- -> std::enable_if_t<DerivationClause(nt::Iterable) && impl::has_free_end_v<BaseType>,
- typename new_type<BaseType, TagType, DerivationClause>::iterator>
- {
- return end(obj.m_value);
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr end(new_type<BaseType, TagType, DerivationClause> const & obj)
- -> std::enable_if_t<DerivationClause(nt::Iterable) && impl::has_free_end_v<BaseType const>,
- typename new_type<BaseType, TagType, DerivationClause>::const_iterator>
- {
- return end(obj.m_value);
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr cend(new_type<BaseType, TagType, DerivationClause> const & obj)
- -> std::enable_if_t<DerivationClause(nt::Iterable) && impl::has_free_cend_v<BaseType const>,
- typename new_type<BaseType, TagType, DerivationClause>::const_iterator>
- {
- return cend(obj.m_value);
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr rend(new_type<BaseType, TagType, DerivationClause> & obj)
- -> std::enable_if_t<DerivationClause(nt::Iterable) && impl::has_free_rend_v<BaseType>,
- typename new_type<BaseType, TagType, DerivationClause>::reverse_iterator>
- {
- return rend(obj.m_value);
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr rend(new_type<BaseType, TagType, DerivationClause> const & obj)
- -> std::enable_if_t<DerivationClause(nt::Iterable) && impl::has_free_rend_v<BaseType const>,
- typename new_type<BaseType, TagType, DerivationClause>::const_reverse_iterator>
- {
- return rend(obj.m_value);
- }
-
- template<typename BaseType, typename TagType, auto DerivationClause>
- auto constexpr crend(new_type<BaseType, TagType, DerivationClause> const & obj)
- -> std::enable_if_t<DerivationClause(nt::Iterable) && impl::has_free_crend_v<BaseType const>,
- typename new_type<BaseType, TagType, DerivationClause>::const_reverse_iterator>
- {
- return crend(obj.m_value);
- }
-
-} // namespace nt
-
-namespace std
-{
- template<typename BaseType, typename TagType, auto DerivationClause>
- struct hash<nt::new_type<BaseType, TagType, DerivationClause>>
- {
- template<typename BaseTypeT = BaseType, auto DerivationClauseV = DerivationClause>
- auto constexpr operator()(nt::new_type<BaseType, TagType, DerivationClause> const & object,
- std::enable_if_t<DerivationClauseV(nt::Hash) && nt::impl::is_hashable_v<BaseTypeT>> * = nullptr) const
- -> std::size_t
- {
- return std::hash<BaseType>{}(object.decay());
- }
- };
-} // namespace std
-
-#endif
diff --git a/include/newtype/version.hpp b/include/newtype/version.hpp
deleted file mode 100644
index 8678514..0000000
--- a/include/newtype/version.hpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef NEWTYPE_VERSION_HPP
-#define NEWTYPE_VERSION_HPP
-
-namespace nt
-{
-
- constexpr struct
- {
- int const major;
- int const minor;
- int const patch;
-
- char const * const name;
- } version{
- .major = 1,
- .minor = 1,
- .patch = 0,
- .name = "Anastasia",
- };
-
-} // namespace nt
-
-#endif \ No newline at end of file