diff --git a/develop/singles/headers/meta.hpp/meta_all.hpp b/develop/singles/headers/meta.hpp/meta_all.hpp index 7cb2da4..183ccda 100644 --- a/develop/singles/headers/meta.hpp/meta_all.hpp +++ b/develop/singles/headers/meta.hpp/meta_all.hpp @@ -290,7 +290,7 @@ namespace meta_hpp::detail # define META_HPP_TRY try # define META_HPP_CATCH(e) catch(e) # define META_HPP_RETHROW() throw -# define META_HPP_THROW_AS(e, m) throw e{m} +# define META_HPP_THROW_AS(e, m) throw e(m) #else # define META_HPP_TRY if ( true ) # define META_HPP_CATCH(e) if ( false ) @@ -608,7 +608,17 @@ namespace meta_hpp::detail std::size_t hash_{fnv1a_hash("", 0)}; }; - constexpr void swap(hashed_string& l, hashed_string& r) noexcept { l.swap(r); } + constexpr void swap(hashed_string& l, hashed_string& r) noexcept { + l.swap(r); + } + + [[nodiscard]] constexpr bool operator==(hashed_string l, std::string_view r) noexcept { + return l == hashed_string{r}; + } + + [[nodiscard]] constexpr std::strong_ordering operator<=>(hashed_string l, std::string_view r) noexcept { + return l <=> hashed_string{r}; + } } namespace std @@ -847,27 +857,29 @@ namespace meta_hpp::detail } template < typename T > - void swap(intrusive_ptr& l, intrusive_ptr& r) noexcept { return l.swap(r); } + void swap(intrusive_ptr& l, intrusive_ptr& r) noexcept { + return l.swap(r); + } template < typename T > - [[nodiscard]] bool operator==(const intrusive_ptr& l, const T* r) noexcept { return l.get() == r; } - template < typename T > - [[nodiscard]] bool operator==(const T* l, const intrusive_ptr& r) noexcept { return l == r.get(); } + [[nodiscard]] bool operator==(const intrusive_ptr& l, const T* r) noexcept { + return l.get() == r; + } template < typename T > - [[nodiscard]] std::strong_ordering operator<=>(const intrusive_ptr& l, const T* r) noexcept { return l.get() <=> r; } - template < typename T > - [[nodiscard]] std::strong_ordering operator<=>(const T* l, const intrusive_ptr& r) noexcept { return l <=> r.get(); } + [[nodiscard]] std::strong_ordering operator<=>(const intrusive_ptr& l, const T* r) noexcept { + return l.get() <=> r; + } template < typename T > - [[nodiscard]] bool operator==(const intrusive_ptr& l, std::nullptr_t) noexcept { return !l; } - template < typename T > - [[nodiscard]] bool operator==(std::nullptr_t, const intrusive_ptr& r) noexcept { return !r; } + [[nodiscard]] bool operator==(const intrusive_ptr& l, std::nullptr_t) noexcept { + return !l; + } template < typename T > - [[nodiscard]] std::strong_ordering operator<=>(const intrusive_ptr& l, std::nullptr_t) noexcept { return l <=> nullptr; } - template < typename T > - [[nodiscard]] std::strong_ordering operator<=>(std::nullptr_t, const intrusive_ptr& r) noexcept { return nullptr <=> r; } + [[nodiscard]] std::strong_ordering operator<=>(const intrusive_ptr& l, std::nullptr_t) noexcept { + return l <=> nullptr; + } } namespace std @@ -994,7 +1006,9 @@ namespace meta_hpp::detail std::align_val_t align_{}; }; - inline void swap(memory_buffer& l, memory_buffer& r) noexcept { l.swap(r); } + inline void swap(memory_buffer& l, memory_buffer& r) noexcept { + l.swap(r); + } } namespace std @@ -1136,6 +1150,10 @@ namespace meta_hpp::detail return id; } }; + + inline void swap(type_id& l, type_id& r) noexcept { + l.swap(r); + } } namespace std @@ -1160,7 +1178,7 @@ namespace meta_hpp::detail concept enum_kind = std::is_enum_v; template < typename T > - concept function_kind = std::is_pointer_v && std::is_function_v>; + concept function_kind = (std::is_pointer_v && std::is_function_v>); template < typename T > concept member_kind = std::is_member_object_pointer_v; @@ -1175,7 +1193,7 @@ namespace meta_hpp::detail concept number_kind = std::is_arithmetic_v; template < typename T > - concept pointer_kind = std::is_pointer_v && !std::is_function_v>; + concept pointer_kind = (std::is_pointer_v && !std::is_function_v>); template < typename T > concept reference_kind = std::is_reference_v; @@ -2357,20 +2375,10 @@ namespace meta_hpp return l.is_valid() && l.get_id() == r; } - template < detail::type_family U > - [[nodiscard]] bool operator==(type_id l, const U& r) noexcept { - return r.is_valid() && l == r.get_id(); - } - template < detail::type_family T > [[nodiscard]] std::strong_ordering operator<=>(const T& l, type_id r) noexcept { return l.is_valid() ? l.get_id() <=> r : std::strong_ordering::less; } - - template < detail::type_family U > - [[nodiscard]] std::strong_ordering operator<=>(type_id l, const U& r) noexcept { - return r.is_valid() ? l <=> r.get_id() : std::strong_ordering::greater; - } } namespace meta_hpp::detail @@ -3270,23 +3278,11 @@ namespace meta_hpp return l.is_valid() && l.get_index() == r; } - template < typename T, detail::state_family U > - requires std::is_same_v - [[nodiscard]] bool operator==(const T& l, const U& r) noexcept { - return r.is_valid() && l == r.get_index(); - } - template < detail::state_family T, typename U > requires std::is_same_v [[nodiscard]] std::strong_ordering operator<=>(const T& l, const U& r) noexcept { return l.is_valid() ? l.get_index() <=> r : std::strong_ordering::less; } - - template < typename T, detail::state_family U > - requires std::is_same_v - [[nodiscard]] std::strong_ordering operator<=>(const T& l, const U& r) noexcept { - return r.is_valid() ? l <=> r.get_index() : std::strong_ordering::greater; - } } namespace meta_hpp::detail diff --git a/headers/meta.hpp/meta_base/exceptions.hpp b/headers/meta.hpp/meta_base/exceptions.hpp index 3e70b1d..a87eb58 100644 --- a/headers/meta.hpp/meta_base/exceptions.hpp +++ b/headers/meta.hpp/meta_base/exceptions.hpp @@ -12,7 +12,7 @@ # define META_HPP_TRY try # define META_HPP_CATCH(e) catch(e) # define META_HPP_RETHROW() throw -# define META_HPP_THROW_AS(e, m) throw e{m} +# define META_HPP_THROW_AS(e, m) throw e(m) #else # define META_HPP_TRY if ( true ) # define META_HPP_CATCH(e) if ( false ) diff --git a/headers/meta.hpp/meta_base/hashed_string.hpp b/headers/meta.hpp/meta_base/hashed_string.hpp index c360f46..edccef3 100644 --- a/headers/meta.hpp/meta_base/hashed_string.hpp +++ b/headers/meta.hpp/meta_base/hashed_string.hpp @@ -44,13 +44,17 @@ namespace meta_hpp::detail std::size_t hash_{fnv1a_hash("", 0)}; }; - constexpr void swap(hashed_string& l, hashed_string& r) noexcept { l.swap(r); } + constexpr void swap(hashed_string& l, hashed_string& r) noexcept { + l.swap(r); + } - [[nodiscard]] constexpr bool operator==(hashed_string l, std::string_view r) noexcept { return l == hashed_string{r}; } - [[nodiscard]] constexpr bool operator==(std::string_view l, hashed_string r) noexcept { return hashed_string{l} == r; } + [[nodiscard]] constexpr bool operator==(hashed_string l, std::string_view r) noexcept { + return l == hashed_string{r}; + } - [[nodiscard]] constexpr std::strong_ordering operator<=>(hashed_string l, std::string_view r) noexcept { return l <=> hashed_string{r}; } - [[nodiscard]] constexpr std::strong_ordering operator<=>(std::string_view l, hashed_string r) noexcept { return hashed_string{l} <=> r; } + [[nodiscard]] constexpr std::strong_ordering operator<=>(hashed_string l, std::string_view r) noexcept { + return l <=> hashed_string{r}; + } } namespace std diff --git a/headers/meta.hpp/meta_base/intrusive_ptr.hpp b/headers/meta.hpp/meta_base/intrusive_ptr.hpp index e0421a3..76dba4f 100644 --- a/headers/meta.hpp/meta_base/intrusive_ptr.hpp +++ b/headers/meta.hpp/meta_base/intrusive_ptr.hpp @@ -160,27 +160,29 @@ namespace meta_hpp::detail } template < typename T > - void swap(intrusive_ptr& l, intrusive_ptr& r) noexcept { return l.swap(r); } + void swap(intrusive_ptr& l, intrusive_ptr& r) noexcept { + return l.swap(r); + } template < typename T > - [[nodiscard]] bool operator==(const intrusive_ptr& l, const T* r) noexcept { return l.get() == r; } - template < typename T > - [[nodiscard]] bool operator==(const T* l, const intrusive_ptr& r) noexcept { return l == r.get(); } + [[nodiscard]] bool operator==(const intrusive_ptr& l, const T* r) noexcept { + return l.get() == r; + } template < typename T > - [[nodiscard]] std::strong_ordering operator<=>(const intrusive_ptr& l, const T* r) noexcept { return l.get() <=> r; } - template < typename T > - [[nodiscard]] std::strong_ordering operator<=>(const T* l, const intrusive_ptr& r) noexcept { return l <=> r.get(); } + [[nodiscard]] std::strong_ordering operator<=>(const intrusive_ptr& l, const T* r) noexcept { + return l.get() <=> r; + } template < typename T > - [[nodiscard]] bool operator==(const intrusive_ptr& l, std::nullptr_t) noexcept { return !l; } - template < typename T > - [[nodiscard]] bool operator==(std::nullptr_t, const intrusive_ptr& r) noexcept { return !r; } + [[nodiscard]] bool operator==(const intrusive_ptr& l, std::nullptr_t) noexcept { + return !l; + } template < typename T > - [[nodiscard]] std::strong_ordering operator<=>(const intrusive_ptr& l, std::nullptr_t) noexcept { return l <=> nullptr; } - template < typename T > - [[nodiscard]] std::strong_ordering operator<=>(std::nullptr_t, const intrusive_ptr& r) noexcept { return nullptr <=> r; } + [[nodiscard]] std::strong_ordering operator<=>(const intrusive_ptr& l, std::nullptr_t) noexcept { + return l <=> nullptr; + } } namespace std diff --git a/headers/meta.hpp/meta_base/memory_buffer.hpp b/headers/meta.hpp/meta_base/memory_buffer.hpp index 7e93084..8363c5c 100644 --- a/headers/meta.hpp/meta_base/memory_buffer.hpp +++ b/headers/meta.hpp/meta_base/memory_buffer.hpp @@ -111,7 +111,9 @@ namespace meta_hpp::detail std::align_val_t align_{}; }; - inline void swap(memory_buffer& l, memory_buffer& r) noexcept { l.swap(r); } + inline void swap(memory_buffer& l, memory_buffer& r) noexcept { + l.swap(r); + } } namespace std diff --git a/headers/meta.hpp/meta_base/type_id.hpp b/headers/meta.hpp/meta_base/type_id.hpp index fc3773d..fee01d0 100644 --- a/headers/meta.hpp/meta_base/type_id.hpp +++ b/headers/meta.hpp/meta_base/type_id.hpp @@ -56,7 +56,9 @@ namespace meta_hpp::detail } }; - inline void swap(type_id& l, type_id& r) noexcept { l.swap(r); } + inline void swap(type_id& l, type_id& r) noexcept { + l.swap(r); + } } namespace std diff --git a/headers/meta.hpp/meta_base/type_kinds.hpp b/headers/meta.hpp/meta_base/type_kinds.hpp index 7315004..5457699 100644 --- a/headers/meta.hpp/meta_base/type_kinds.hpp +++ b/headers/meta.hpp/meta_base/type_kinds.hpp @@ -20,7 +20,7 @@ namespace meta_hpp::detail concept enum_kind = std::is_enum_v; template < typename T > - concept function_kind = std::is_pointer_v && std::is_function_v>; + concept function_kind = (std::is_pointer_v && std::is_function_v>); template < typename T > concept member_kind = std::is_member_object_pointer_v; @@ -35,7 +35,7 @@ namespace meta_hpp::detail concept number_kind = std::is_arithmetic_v; template < typename T > - concept pointer_kind = std::is_pointer_v && !std::is_function_v>; + concept pointer_kind = (std::is_pointer_v && !std::is_function_v>); template < typename T > concept reference_kind = std::is_reference_v; diff --git a/headers/meta.hpp/meta_states.hpp b/headers/meta.hpp/meta_states.hpp index 684b6d9..53f48e1 100644 --- a/headers/meta.hpp/meta_states.hpp +++ b/headers/meta.hpp/meta_states.hpp @@ -436,23 +436,11 @@ namespace meta_hpp return l.is_valid() && l.get_index() == r; } - template < typename T, detail::state_family U > - requires std::is_same_v - [[nodiscard]] bool operator==(const T& l, const U& r) noexcept { - return r.is_valid() && l == r.get_index(); - } - template < detail::state_family T, typename U > requires std::is_same_v [[nodiscard]] std::strong_ordering operator<=>(const T& l, const U& r) noexcept { return l.is_valid() ? l.get_index() <=> r : std::strong_ordering::less; } - - template < typename T, detail::state_family U > - requires std::is_same_v - [[nodiscard]] std::strong_ordering operator<=>(const T& l, const U& r) noexcept { - return r.is_valid() ? l <=> r.get_index() : std::strong_ordering::greater; - } } namespace meta_hpp::detail diff --git a/headers/meta.hpp/meta_types.hpp b/headers/meta.hpp/meta_types.hpp index 5102451..7d2a3c7 100644 --- a/headers/meta.hpp/meta_types.hpp +++ b/headers/meta.hpp/meta_types.hpp @@ -492,20 +492,10 @@ namespace meta_hpp return l.is_valid() && l.get_id() == r; } - template < detail::type_family U > - [[nodiscard]] bool operator==(type_id l, const U& r) noexcept { - return r.is_valid() && l == r.get_id(); - } - template < detail::type_family T > [[nodiscard]] std::strong_ordering operator<=>(const T& l, type_id r) noexcept { return l.is_valid() ? l.get_id() <=> r : std::strong_ordering::less; } - - template < detail::type_family U > - [[nodiscard]] std::strong_ordering operator<=>(type_id l, const U& r) noexcept { - return r.is_valid() ? l <=> r.get_id() : std::strong_ordering::greater; - } } namespace meta_hpp::detail