diff --git a/develop/singles/headers/meta.hpp/meta_all.hpp b/develop/singles/headers/meta.hpp/meta_all.hpp index c5cddf2..fa00100 100644 --- a/develop/singles/headers/meta.hpp/meta_all.hpp +++ b/develop/singles/headers/meta.hpp/meta_all.hpp @@ -441,12 +441,12 @@ namespace meta_hpp::detail return *this; } - [[nodiscard]] bool is_empty() const noexcept { - return vtable_ == nullptr; + [[nodiscard]] bool is_valid() const noexcept { + return vtable_ != nullptr; } [[nodiscard]] explicit operator bool() const noexcept { - return vtable_ != nullptr; + return is_valid(); } R operator()(Args... args) const { @@ -1088,12 +1088,12 @@ namespace meta_hpp::detail reset(); } - [[nodiscard]] bool is_empty() const noexcept { - return data_ == nullptr; + [[nodiscard]] bool is_valid() const noexcept { + return data_ != nullptr; } [[nodiscard]] explicit operator bool() const noexcept { - return data_ != nullptr; + return is_valid(); } void reset() noexcept { @@ -2235,12 +2235,12 @@ namespace meta_hpp type_base& operator=(type_base&&) noexcept = default; type_base& operator=(const type_base&) = default; - [[nodiscard]] bool is_empty() const noexcept { - return data_ == nullptr; + [[nodiscard]] bool is_valid() const noexcept { + return data_ != nullptr; } [[nodiscard]] explicit operator bool() const noexcept { - return data_ != nullptr; + return is_valid(); } [[nodiscard]] type_id get_id() const noexcept { @@ -2497,7 +2497,7 @@ namespace std template < meta_hpp::detail::type_family Type > struct hash { size_t operator()(const Type& type) const noexcept { - return type.is_empty() ? 0 : type.get_id().get_hash(); + return type.is_valid() ? type.get_id().get_hash() : 0; } }; } @@ -2506,15 +2506,15 @@ namespace meta_hpp { template < detail::type_family L, detail::type_family R > [[nodiscard]] bool operator==(const L& l, const R& r) noexcept { - return l.is_empty() == r.is_empty() && (l.is_empty() || l.get_id() == r.get_id()); + return l.is_valid() == r.is_valid() && (!l.is_valid() || l.get_id() == r.get_id()); } template < detail::type_family L, detail::type_family R > [[nodiscard]] std::strong_ordering operator<=>(const L& l, const R& r) noexcept { - if ( const std::strong_ordering cmp{!l.is_empty() <=> !r.is_empty()}; cmp != std::strong_ordering::equal ) { + if ( const std::strong_ordering cmp{l.is_valid() <=> r.is_valid()}; cmp != std::strong_ordering::equal ) { return cmp; } - return l.is_empty() ? std::strong_ordering::equal : l.get_id() <=> r.get_id(); + return l.is_valid() ? l.get_id() <=> r.get_id() : std::strong_ordering::equal; } } @@ -2522,12 +2522,12 @@ namespace meta_hpp { template < detail::type_family L > [[nodiscard]] bool operator==(const L& l, type_id r) noexcept { - return !l.is_empty() && l.get_id() == r; + return l.is_valid() && l.get_id() == r; } template < detail::type_family L > [[nodiscard]] std::strong_ordering operator<=>(const L& l, type_id r) noexcept { - return !l.is_empty() ? l.get_id() <=> r : std::strong_ordering::less; + return l.is_valid() ? l.get_id() <=> r : std::strong_ordering::less; } } @@ -3366,12 +3366,12 @@ namespace meta_hpp state_base& operator=(state_base&&) noexcept = default; state_base& operator=(const state_base&) = default; - [[nodiscard]] bool is_empty() const noexcept { - return state_ == nullptr; + [[nodiscard]] bool is_valid() const noexcept { + return state_ != nullptr; } [[nodiscard]] explicit operator bool() const noexcept { - return state_ != nullptr; + return is_valid(); } [[nodiscard]] const index_type& get_index() const noexcept { @@ -3632,7 +3632,7 @@ namespace std template < meta_hpp::detail::state_family State > struct hash { size_t operator()(const State& state) const noexcept { - return state.is_empty() ? 0 : state.get_index().get_hash(); + return state.is_valid() ? state.get_index().get_hash() : 0; } }; } @@ -3641,15 +3641,15 @@ namespace meta_hpp { template < detail::state_family L, detail::state_family R > [[nodiscard]] bool operator==(const L& l, const R& r) noexcept { - return l.is_empty() == r.is_empty() && (l.is_empty() || l.get_index() == r.get_index()); + return l.is_valid() == r.is_valid() && (!l.is_valid() || l.get_index() == r.get_index()); } template < detail::state_family L, detail::state_family R > [[nodiscard]] std::strong_ordering operator<=>(const L& l, const R& r) noexcept { - if ( const std::strong_ordering cmp{!l.is_empty() <=> !r.is_empty()}; cmp != std::strong_ordering::equal ) { + if ( const std::strong_ordering cmp{l.is_valid() <=> r.is_valid()}; cmp != std::strong_ordering::equal ) { return cmp; } - return l.is_empty() ? std::strong_ordering::equal : l.get_index() <=> r.get_index(); + return l.is_valid() ? l.get_index() <=> r.get_index() : std::strong_ordering::equal; } } @@ -3657,12 +3657,12 @@ namespace meta_hpp { template < detail::state_family L, detail::index_family R > [[nodiscard]] bool operator==(const L& l, const R& r) noexcept { - return !l.is_empty() && l.get_index() == r; + return l.is_valid() && l.get_index() == r; } template < detail::state_family L, detail::index_family R > [[nodiscard]] std::strong_ordering operator<=>(const L& l, const R& r) noexcept { - return !l.is_empty() ? l.get_index() <=> r : std::strong_ordering::less; + return l.is_valid() ? l.get_index() <=> r : std::strong_ordering::less; } } @@ -7873,7 +7873,7 @@ namespace meta_hpp } inline bool class_type::is_base_of(const class_type& derived) const noexcept { - if ( is_empty() || derived.is_empty() ) { + if ( !is_valid() || !derived.is_valid() ) { return false; } @@ -7897,7 +7897,7 @@ namespace meta_hpp } inline bool class_type::is_derived_from(const class_type& base) const noexcept { - if ( is_empty() || base.is_empty() ) { + if ( !is_valid() || !base.is_valid() ) { return false; } diff --git a/develop/unbench/invoke_function_bench.cpp b/develop/unbench/invoke_function_bench.cpp index 470c094..2d58ef2 100644 --- a/develop/unbench/invoke_function_bench.cpp +++ b/develop/unbench/invoke_function_bench.cpp @@ -128,7 +128,7 @@ namespace [[maybe_unused]] void meta_invoke_function_1(benchmark::State &state) { meta::function f = meta_bench_scope.get_function("static_function_1"); - META_HPP_ASSERT(!f.is_empty()); + META_HPP_ASSERT(f.is_valid()); for ( auto _ : state ) { f(static_angle); @@ -138,7 +138,7 @@ namespace [[maybe_unused]] void meta_invoke_function_2(benchmark::State &state) { meta::function f = meta_bench_scope.get_function("static_function_2"); - META_HPP_ASSERT(!f.is_empty()); + META_HPP_ASSERT(f.is_valid()); for ( auto _ : state ) { f(static_angle, vmath::unit3_x); @@ -148,7 +148,7 @@ namespace [[maybe_unused]] void meta_invoke_function_3(benchmark::State &state) { meta::function f = meta_bench_scope.get_function("static_function_3"); - META_HPP_ASSERT(!f.is_empty()); + META_HPP_ASSERT(f.is_valid()); for ( auto _ : state ) { f(static_angle, vmath::unit3_x, 2.f); @@ -158,7 +158,7 @@ namespace [[maybe_unused]] void meta_invoke_function_4(benchmark::State &state) { meta::function f = meta_bench_scope.get_function("static_function_4"); - META_HPP_ASSERT(!f.is_empty()); + META_HPP_ASSERT(f.is_valid()); for ( auto _ : state ) { f(static_angle, vmath::unit3_x, 2.f, vmath::midentity3); diff --git a/develop/untests/meta_base/fixed_function_tests.cpp b/develop/untests/meta_base/fixed_function_tests.cpp index 8e32ada..ca163b8 100644 --- a/develop/untests/meta_base/fixed_function_tests.cpp +++ b/develop/untests/meta_base/fixed_function_tests.cpp @@ -15,12 +15,12 @@ TEST_CASE("meta/meta_base/fixed_function") { { fixed_function ff; CHECK_FALSE(ff); - CHECK(ff.is_empty()); + CHECK_FALSE(ff.is_valid()); } { fixed_function ff = []{}; CHECK(ff); - CHECK_FALSE(ff.is_empty()); + CHECK(ff.is_valid()); } } @@ -46,11 +46,11 @@ TEST_CASE("meta/meta_base/fixed_function") { ff.reset(); CHECK_FALSE(ff); - CHECK(ff.is_empty()); + CHECK_FALSE(ff.is_valid()); ff = []{return 1;}; CHECK(ff); - CHECK_FALSE(ff.is_empty()); + CHECK(ff.is_valid()); CHECK(ff() == 1); } diff --git a/develop/untests/meta_base/memory_buffer_tests.cpp b/develop/untests/meta_base/memory_buffer_tests.cpp index 5413695..5804f6c 100644 --- a/develop/untests/meta_base/memory_buffer_tests.cpp +++ b/develop/untests/meta_base/memory_buffer_tests.cpp @@ -15,7 +15,7 @@ TEST_CASE("meta/meta_base/memory_buffer") { memory_buffer buf; CHECK(!buf); - CHECK(buf.is_empty()); + CHECK_FALSE(buf.is_valid()); CHECK(buf.get_size() == 0); CHECK(buf.get_align() == std::align_val_t{}); @@ -32,7 +32,7 @@ TEST_CASE("meta/meta_base/memory_buffer") { { CHECK(!buf1); - CHECK(buf1.is_empty()); + CHECK_FALSE(buf1.is_valid()); CHECK(buf1.get_size() == 0); CHECK(buf1.get_align() == std::align_val_t{}); @@ -43,7 +43,7 @@ TEST_CASE("meta/meta_base/memory_buffer") { { CHECK(buf2); - CHECK(!buf2.is_empty()); + CHECK(buf2.is_valid()); CHECK(buf2.get_size() == 10); CHECK(buf2.get_align() == std::align_val_t{32}); @@ -57,7 +57,7 @@ TEST_CASE("meta/meta_base/memory_buffer") { memory_buffer buf{10, std::align_val_t{32}}; CHECK(buf); - CHECK(!buf.is_empty()); + CHECK(buf.is_valid()); CHECK(buf.get_size() == 10); CHECK(buf.get_align() == std::align_val_t{32}); @@ -82,7 +82,7 @@ TEST_CASE("meta/meta_base/memory_buffer") { { CHECK(!buf1); - CHECK(buf1.is_empty()); + CHECK_FALSE(buf1.is_valid()); CHECK(buf1.get_size() == 0); CHECK(buf1.get_align() == std::align_val_t{}); @@ -93,7 +93,7 @@ TEST_CASE("meta/meta_base/memory_buffer") { { CHECK(buf2); - CHECK(!buf2.is_empty()); + CHECK(buf2.is_valid()); CHECK(buf2.get_size() == 10); CHECK(buf2.get_align() == std::align_val_t{32}); @@ -112,7 +112,7 @@ TEST_CASE("meta/meta_base/memory_buffer") { { CHECK(!buf1); - CHECK(buf1.is_empty()); + CHECK_FALSE(buf1.is_valid()); CHECK(buf1.get_size() == 0); CHECK(buf1.get_align() == std::align_val_t{}); @@ -123,7 +123,7 @@ TEST_CASE("meta/meta_base/memory_buffer") { { CHECK(buf2); - CHECK(!buf2.is_empty()); + CHECK(buf2.is_valid()); CHECK(buf2.get_size() == 10); CHECK(buf2.get_align() == std::align_val_t{32}); @@ -138,7 +138,7 @@ TEST_CASE("meta/meta_base/memory_buffer") { buf.reset(); CHECK(!buf); - CHECK(buf.is_empty()); + CHECK_FALSE(buf.is_valid()); CHECK(buf.get_size() == 0); CHECK(buf.get_align() == std::align_val_t{}); diff --git a/develop/untests/meta_states/evalue_tests.cpp b/develop/untests/meta_states/evalue_tests.cpp index 650e50e..a6b5b42 100644 --- a/develop/untests/meta_states/evalue_tests.cpp +++ b/develop/untests/meta_states/evalue_tests.cpp @@ -34,7 +34,7 @@ TEST_CASE("meta/meta_states/evalue") { SUBCASE("") { const meta::evalue evalue; CHECK_FALSE(evalue); - CHECK(evalue.is_empty()); + CHECK_FALSE(evalue.is_valid()); CHECK(evalue == color_type.get_evalue("non-existent-evalue")); } diff --git a/develop/untests/meta_states/function_tests.cpp b/develop/untests/meta_states/function_tests.cpp index 6ae8a98..8fd3a42 100644 --- a/develop/untests/meta_states/function_tests.cpp +++ b/develop/untests/meta_states/function_tests.cpp @@ -51,7 +51,7 @@ TEST_CASE("meta/meta_states/function") { SUBCASE("") { const meta::function func; CHECK_FALSE(func); - CHECK(func.is_empty()); + CHECK_FALSE(func.is_valid()); CHECK(func == ivec2_type.get_function("non-existent-function")); } diff --git a/develop/untests/meta_states/member_tests.cpp b/develop/untests/meta_states/member_tests.cpp index d21e863..2b338ad 100644 --- a/develop/untests/meta_states/member_tests.cpp +++ b/develop/untests/meta_states/member_tests.cpp @@ -38,7 +38,7 @@ TEST_CASE("meta/meta_states/member") { SUBCASE("") { const meta::member member; CHECK_FALSE(member); - CHECK(member.is_empty()); + CHECK_FALSE(member.is_valid()); CHECK(member == clazz_1_type.get_member("non-existent-member")); } diff --git a/develop/untests/meta_states/method_tests.cpp b/develop/untests/meta_states/method_tests.cpp index 39378a1..7896505 100644 --- a/develop/untests/meta_states/method_tests.cpp +++ b/develop/untests/meta_states/method_tests.cpp @@ -102,7 +102,7 @@ TEST_CASE("meta/meta_states/method") { SUBCASE("") { const meta::method method; CHECK_FALSE(method); - CHECK(method.is_empty()); + CHECK_FALSE(method.is_valid()); CHECK(method == ct.get_method("non-existent-method")); } diff --git a/develop/untests/meta_states/scope_tests.cpp b/develop/untests/meta_states/scope_tests.cpp index d1ba989..8be6265 100644 --- a/develop/untests/meta_states/scope_tests.cpp +++ b/develop/untests/meta_states/scope_tests.cpp @@ -57,7 +57,7 @@ TEST_CASE("meta/meta_states/scope") { const meta::scope math_scope = meta::resolve_scope("meta/meta_states/scope/math"); REQUIRE(math_scope); - REQUIRE(!math_scope.is_empty()); + REQUIRE(math_scope.is_valid()); CHECK(math_scope.get_name() == "meta/meta_states/scope/math"); CHECK(math_scope.get_variables().size() == 2); @@ -66,7 +66,7 @@ TEST_CASE("meta/meta_states/scope") { SUBCASE("") { const meta::scope scope; CHECK_FALSE(scope); - CHECK(scope.is_empty()); + CHECK_FALSE(scope.is_valid()); } SUBCASE("operators") { diff --git a/develop/untests/meta_states/variable_tests.cpp b/develop/untests/meta_states/variable_tests.cpp index 26dffbf..d28e2d1 100644 --- a/develop/untests/meta_states/variable_tests.cpp +++ b/develop/untests/meta_states/variable_tests.cpp @@ -68,7 +68,7 @@ TEST_CASE("meta/meta_states/variable") { SUBCASE("") { const meta::variable variable; CHECK_FALSE(variable); - CHECK(variable.is_empty()); + CHECK_FALSE(variable.is_valid()); CHECK(variable == clazz_1_type.get_variable("non-existent-variable")); } diff --git a/develop/untests/meta_types/any_type_tests.cpp b/develop/untests/meta_types/any_type_tests.cpp index 15cfc32..1f851b0 100644 --- a/develop/untests/meta_types/any_type_tests.cpp +++ b/develop/untests/meta_types/any_type_tests.cpp @@ -39,7 +39,7 @@ TEST_CASE("meta/meta_types/any_type") { SUBCASE("") { const meta::any_type type{}; CHECK_FALSE(type); - CHECK(type.is_empty()); + CHECK_FALSE(type.is_valid()); CHECK_FALSE(type.is_array()); CHECK_FALSE(type.as_array()); diff --git a/develop/untests/meta_types/array_type_tests.cpp b/develop/untests/meta_types/array_type_tests.cpp index eb5f54d..eb46470 100644 --- a/develop/untests/meta_types/array_type_tests.cpp +++ b/develop/untests/meta_types/array_type_tests.cpp @@ -13,7 +13,7 @@ TEST_CASE("meta/meta_types/array_type") { SUBCASE("") { const meta::array_type type; CHECK_FALSE(type); - CHECK(type.is_empty()); + CHECK_FALSE(type.is_valid()); } SUBCASE("int[]") { diff --git a/develop/untests/meta_types/function_type_tests.cpp b/develop/untests/meta_types/function_type_tests.cpp index c4fdbe1..f445018 100644 --- a/develop/untests/meta_types/function_type_tests.cpp +++ b/develop/untests/meta_types/function_type_tests.cpp @@ -30,7 +30,7 @@ TEST_CASE("meta/meta_types/function_type") { SUBCASE("") { const meta::function_type type; CHECK_FALSE(type); - CHECK(type.is_empty()); + CHECK_FALSE(type.is_valid()); } SUBCASE("arg_copy") { diff --git a/develop/untests/meta_types/member_type_tests.cpp b/develop/untests/meta_types/member_type_tests.cpp index 600930d..695ddbd 100644 --- a/develop/untests/meta_types/member_type_tests.cpp +++ b/develop/untests/meta_types/member_type_tests.cpp @@ -21,7 +21,7 @@ TEST_CASE("meta/meta_types/member_type") { SUBCASE("") { const meta::member_type type; CHECK_FALSE(type); - CHECK(type.is_empty()); + CHECK_FALSE(type.is_valid()); } SUBCASE("int") { diff --git a/develop/untests/meta_types/method_type_tests.cpp b/develop/untests/meta_types/method_type_tests.cpp index db14c8a..90b982e 100644 --- a/develop/untests/meta_types/method_type_tests.cpp +++ b/develop/untests/meta_types/method_type_tests.cpp @@ -33,7 +33,7 @@ TEST_CASE("meta/meta_types/method_type") { SUBCASE("") { const meta::method_type type; CHECK_FALSE(type); - CHECK(type.is_empty()); + CHECK_FALSE(type.is_valid()); } SUBCASE("ivec2::at") { diff --git a/develop/untests/meta_types/number_type_tests.cpp b/develop/untests/meta_types/number_type_tests.cpp index a03731c..d9dc437 100644 --- a/develop/untests/meta_types/number_type_tests.cpp +++ b/develop/untests/meta_types/number_type_tests.cpp @@ -13,7 +13,7 @@ TEST_CASE("meta/meta_types/number_type") { SUBCASE("") { const meta::number_type type; CHECK_FALSE(type); - CHECK(type.is_empty()); + CHECK_FALSE(type.is_valid()); } SUBCASE("int") { diff --git a/develop/untests/meta_types/pointer_type_tests.cpp b/develop/untests/meta_types/pointer_type_tests.cpp index 7fbff76..acbeff2 100644 --- a/develop/untests/meta_types/pointer_type_tests.cpp +++ b/develop/untests/meta_types/pointer_type_tests.cpp @@ -13,7 +13,7 @@ TEST_CASE("meta/meta_types/pointer_type") { SUBCASE("") { const meta::pointer_type type; CHECK_FALSE(type); - CHECK(type.is_empty()); + CHECK_FALSE(type.is_valid()); } SUBCASE("int*") { diff --git a/develop/untests/meta_types/reference_type_tests.cpp b/develop/untests/meta_types/reference_type_tests.cpp index f809b01..85b5ceb 100644 --- a/develop/untests/meta_types/reference_type_tests.cpp +++ b/develop/untests/meta_types/reference_type_tests.cpp @@ -13,7 +13,7 @@ TEST_CASE("meta/meta_types/reference_type") { SUBCASE("") { const meta::reference_type type; CHECK_FALSE(type); - CHECK(type.is_empty()); + CHECK_FALSE(type.is_valid()); } SUBCASE("int&") { diff --git a/develop/untests/meta_types/void_type_tests.cpp b/develop/untests/meta_types/void_type_tests.cpp index 855940f..1d89669 100644 --- a/develop/untests/meta_types/void_type_tests.cpp +++ b/develop/untests/meta_types/void_type_tests.cpp @@ -13,7 +13,7 @@ TEST_CASE("meta/meta_types/void_type") { SUBCASE("") { const meta::void_type type; CHECK_FALSE(type); - CHECK(type.is_empty()); + CHECK_FALSE(type.is_valid()); } SUBCASE("void") { diff --git a/headers/meta.hpp/meta_base/fixed_function.hpp b/headers/meta.hpp/meta_base/fixed_function.hpp index a86e7da..a39275f 100644 --- a/headers/meta.hpp/meta_base/fixed_function.hpp +++ b/headers/meta.hpp/meta_base/fixed_function.hpp @@ -60,12 +60,12 @@ namespace meta_hpp::detail return *this; } - [[nodiscard]] bool is_empty() const noexcept { - return vtable_ == nullptr; + [[nodiscard]] bool is_valid() const noexcept { + return vtable_ != nullptr; } [[nodiscard]] explicit operator bool() const noexcept { - return vtable_ != nullptr; + return is_valid(); } R operator()(Args... args) const { diff --git a/headers/meta.hpp/meta_base/memory_buffer.hpp b/headers/meta.hpp/meta_base/memory_buffer.hpp index 0838e59..0c0155e 100644 --- a/headers/meta.hpp/meta_base/memory_buffer.hpp +++ b/headers/meta.hpp/meta_base/memory_buffer.hpp @@ -50,12 +50,12 @@ namespace meta_hpp::detail reset(); } - [[nodiscard]] bool is_empty() const noexcept { - return data_ == nullptr; + [[nodiscard]] bool is_valid() const noexcept { + return data_ != nullptr; } [[nodiscard]] explicit operator bool() const noexcept { - return data_ != nullptr; + return is_valid(); } void reset() noexcept { diff --git a/headers/meta.hpp/meta_states.hpp b/headers/meta.hpp/meta_states.hpp index 8ead6a2..a11f35e 100644 --- a/headers/meta.hpp/meta_states.hpp +++ b/headers/meta.hpp/meta_states.hpp @@ -133,12 +133,12 @@ namespace meta_hpp state_base& operator=(state_base&&) noexcept = default; state_base& operator=(const state_base&) = default; - [[nodiscard]] bool is_empty() const noexcept { - return state_ == nullptr; + [[nodiscard]] bool is_valid() const noexcept { + return state_ != nullptr; } [[nodiscard]] explicit operator bool() const noexcept { - return state_ != nullptr; + return is_valid(); } [[nodiscard]] const index_type& get_index() const noexcept { @@ -399,7 +399,7 @@ namespace std template < meta_hpp::detail::state_family State > struct hash { size_t operator()(const State& state) const noexcept { - return state.is_empty() ? 0 : state.get_index().get_hash(); + return state.is_valid() ? state.get_index().get_hash() : 0; } }; } @@ -408,15 +408,15 @@ namespace meta_hpp { template < detail::state_family L, detail::state_family R > [[nodiscard]] bool operator==(const L& l, const R& r) noexcept { - return l.is_empty() == r.is_empty() && (l.is_empty() || l.get_index() == r.get_index()); + return l.is_valid() == r.is_valid() && (!l.is_valid() || l.get_index() == r.get_index()); } template < detail::state_family L, detail::state_family R > [[nodiscard]] std::strong_ordering operator<=>(const L& l, const R& r) noexcept { - if ( const std::strong_ordering cmp{!l.is_empty() <=> !r.is_empty()}; cmp != std::strong_ordering::equal ) { + if ( const std::strong_ordering cmp{l.is_valid() <=> r.is_valid()}; cmp != std::strong_ordering::equal ) { return cmp; } - return l.is_empty() ? std::strong_ordering::equal : l.get_index() <=> r.get_index(); + return l.is_valid() ? l.get_index() <=> r.get_index() : std::strong_ordering::equal; } } @@ -424,12 +424,12 @@ namespace meta_hpp { template < detail::state_family L, detail::index_family R > [[nodiscard]] bool operator==(const L& l, const R& r) noexcept { - return !l.is_empty() && l.get_index() == r; + return l.is_valid() && l.get_index() == r; } template < detail::state_family L, detail::index_family R > [[nodiscard]] std::strong_ordering operator<=>(const L& l, const R& r) noexcept { - return !l.is_empty() ? l.get_index() <=> r : std::strong_ordering::less; + return l.is_valid() ? l.get_index() <=> r : std::strong_ordering::less; } } diff --git a/headers/meta.hpp/meta_types.hpp b/headers/meta.hpp/meta_types.hpp index 37ec974..dad913c 100644 --- a/headers/meta.hpp/meta_types.hpp +++ b/headers/meta.hpp/meta_types.hpp @@ -65,12 +65,12 @@ namespace meta_hpp type_base& operator=(type_base&&) noexcept = default; type_base& operator=(const type_base&) = default; - [[nodiscard]] bool is_empty() const noexcept { - return data_ == nullptr; + [[nodiscard]] bool is_valid() const noexcept { + return data_ != nullptr; } [[nodiscard]] explicit operator bool() const noexcept { - return data_ != nullptr; + return is_valid(); } [[nodiscard]] type_id get_id() const noexcept { @@ -327,7 +327,7 @@ namespace std template < meta_hpp::detail::type_family Type > struct hash { size_t operator()(const Type& type) const noexcept { - return type.is_empty() ? 0 : type.get_id().get_hash(); + return type.is_valid() ? type.get_id().get_hash() : 0; } }; } @@ -336,15 +336,15 @@ namespace meta_hpp { template < detail::type_family L, detail::type_family R > [[nodiscard]] bool operator==(const L& l, const R& r) noexcept { - return l.is_empty() == r.is_empty() && (l.is_empty() || l.get_id() == r.get_id()); + return l.is_valid() == r.is_valid() && (!l.is_valid() || l.get_id() == r.get_id()); } template < detail::type_family L, detail::type_family R > [[nodiscard]] std::strong_ordering operator<=>(const L& l, const R& r) noexcept { - if ( const std::strong_ordering cmp{!l.is_empty() <=> !r.is_empty()}; cmp != std::strong_ordering::equal ) { + if ( const std::strong_ordering cmp{l.is_valid() <=> r.is_valid()}; cmp != std::strong_ordering::equal ) { return cmp; } - return l.is_empty() ? std::strong_ordering::equal : l.get_id() <=> r.get_id(); + return l.is_valid() ? l.get_id() <=> r.get_id() : std::strong_ordering::equal; } } @@ -352,12 +352,12 @@ namespace meta_hpp { template < detail::type_family L > [[nodiscard]] bool operator==(const L& l, type_id r) noexcept { - return !l.is_empty() && l.get_id() == r; + return l.is_valid() && l.get_id() == r; } template < detail::type_family L > [[nodiscard]] std::strong_ordering operator<=>(const L& l, type_id r) noexcept { - return !l.is_empty() ? l.get_id() <=> r : std::strong_ordering::less; + return l.is_valid() ? l.get_id() <=> r : std::strong_ordering::less; } } diff --git a/headers/meta.hpp/meta_types/class_type.hpp b/headers/meta.hpp/meta_types/class_type.hpp index 67a7c83..25bb524 100644 --- a/headers/meta.hpp/meta_types/class_type.hpp +++ b/headers/meta.hpp/meta_types/class_type.hpp @@ -135,7 +135,7 @@ namespace meta_hpp } inline bool class_type::is_base_of(const class_type& derived) const noexcept { - if ( is_empty() || derived.is_empty() ) { + if ( !is_valid() || !derived.is_valid() ) { return false; } @@ -159,7 +159,7 @@ namespace meta_hpp } inline bool class_type::is_derived_from(const class_type& base) const noexcept { - if ( is_empty() || base.is_empty() ) { + if ( !is_valid() || !base.is_valid() ) { return false; }