mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-15 11:52:08 +07:00
states with their indices compare operators
This commit is contained in:
@@ -20,6 +20,7 @@ target_compile_options(${PROJECT_NAME}.setup_targets INTERFACE
|
|||||||
-Wno-unneeded-member-function
|
-Wno-unneeded-member-function
|
||||||
-Wno-unused-macros
|
-Wno-unused-macros
|
||||||
-Wno-weak-vtables
|
-Wno-weak-vtables
|
||||||
|
-Wno-zero-as-null-pointer-constant
|
||||||
>)
|
>)
|
||||||
|
|
||||||
if(BUILD_WITH_COVERAGE)
|
if(BUILD_WITH_COVERAGE)
|
||||||
|
|||||||
@@ -2534,6 +2534,8 @@ namespace meta_hpp
|
|||||||
{
|
{
|
||||||
class argument final {
|
class argument final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = argument_index;
|
||||||
|
|
||||||
explicit argument() = default;
|
explicit argument() = default;
|
||||||
explicit argument(detail::argument_state_ptr state) noexcept;
|
explicit argument(detail::argument_state_ptr state) noexcept;
|
||||||
argument& operator=(detail::argument_state_ptr state) noexcept;
|
argument& operator=(detail::argument_state_ptr state) noexcept;
|
||||||
@@ -2555,8 +2557,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class constructor final {
|
class constructor final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = constructor_index;
|
||||||
|
|
||||||
explicit constructor() = default;
|
explicit constructor() = default;
|
||||||
explicit constructor(detail::constructor_state_ptr state) noexcept;
|
constructor(detail::constructor_state_ptr state) noexcept;
|
||||||
constructor& operator=(detail::constructor_state_ptr state) noexcept;
|
constructor& operator=(detail::constructor_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -2588,8 +2592,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class destructor final {
|
class destructor final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = destructor_index;
|
||||||
|
|
||||||
explicit destructor() = default;
|
explicit destructor() = default;
|
||||||
explicit destructor(detail::destructor_state_ptr state) noexcept;
|
destructor(detail::destructor_state_ptr state) noexcept;
|
||||||
destructor& operator=(detail::destructor_state_ptr state) noexcept;
|
destructor& operator=(detail::destructor_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -2611,8 +2617,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class evalue final {
|
class evalue final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = evalue_index;
|
||||||
|
|
||||||
explicit evalue() = default;
|
explicit evalue() = default;
|
||||||
explicit evalue(detail::evalue_state_ptr state) noexcept;
|
evalue(detail::evalue_state_ptr state) noexcept;
|
||||||
evalue& operator=(detail::evalue_state_ptr state) noexcept;
|
evalue& operator=(detail::evalue_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -2639,8 +2647,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class function final {
|
class function final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = function_index;
|
||||||
|
|
||||||
explicit function() = default;
|
explicit function() = default;
|
||||||
explicit function(detail::function_state_ptr state) noexcept;
|
function(detail::function_state_ptr state) noexcept;
|
||||||
function& operator=(detail::function_state_ptr state) noexcept;
|
function& operator=(detail::function_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -2673,8 +2683,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class member final {
|
class member final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = member_index;
|
||||||
|
|
||||||
explicit member() = default;
|
explicit member() = default;
|
||||||
explicit member(detail::member_state_ptr state) noexcept;
|
member(detail::member_state_ptr state) noexcept;
|
||||||
member& operator=(detail::member_state_ptr state) noexcept;
|
member& operator=(detail::member_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -2719,8 +2731,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class method final {
|
class method final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = method_index;
|
||||||
|
|
||||||
explicit method() = default;
|
explicit method() = default;
|
||||||
explicit method(detail::method_state_ptr state) noexcept;
|
method(detail::method_state_ptr state) noexcept;
|
||||||
method& operator=(detail::method_state_ptr state) noexcept;
|
method& operator=(detail::method_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -2753,6 +2767,8 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class scope final {
|
class scope final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = scope_index;
|
||||||
|
|
||||||
explicit scope() = default;
|
explicit scope() = default;
|
||||||
explicit scope(detail::scope_state_ptr state) noexcept;
|
explicit scope(detail::scope_state_ptr state) noexcept;
|
||||||
scope& operator=(detail::scope_state_ptr state) noexcept;
|
scope& operator=(detail::scope_state_ptr state) noexcept;
|
||||||
@@ -2786,8 +2802,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class variable final {
|
class variable final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = variable_index;
|
||||||
|
|
||||||
explicit variable() = default;
|
explicit variable() = default;
|
||||||
explicit variable(detail::variable_state_ptr state) noexcept;
|
variable(detail::variable_state_ptr state) noexcept;
|
||||||
variable& operator=(detail::variable_state_ptr state) noexcept;
|
variable& operator=(detail::variable_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -2857,6 +2875,45 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace meta_hpp
|
||||||
|
{
|
||||||
|
template < detail::state_family T, typename U >
|
||||||
|
requires std::is_same_v<U, typename T::index_type>
|
||||||
|
[[nodiscard]] bool operator<(const T& l, const U& r) noexcept {
|
||||||
|
return !static_cast<bool>(l) || l.get_index() < r;
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename T, detail::state_family U >
|
||||||
|
requires std::is_same_v<T, typename U::index_type>
|
||||||
|
[[nodiscard]] bool operator<(const T& l, const U& r) noexcept {
|
||||||
|
return static_cast<bool>(r) && l < r.get_index();
|
||||||
|
}
|
||||||
|
|
||||||
|
template < detail::state_family T, typename U >
|
||||||
|
requires std::is_same_v<U, typename T::index_type>
|
||||||
|
[[nodiscard]] bool operator==(const T& l, const U& r) noexcept {
|
||||||
|
return static_cast<bool>(l) || l.get_index() == r;
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename T, detail::state_family U >
|
||||||
|
requires std::is_same_v<T, typename U::index_type>
|
||||||
|
[[nodiscard]] bool operator==(const T& l, const U& r) noexcept {
|
||||||
|
return static_cast<bool>(r) && l == r.get_index();
|
||||||
|
}
|
||||||
|
|
||||||
|
template < detail::state_family T, typename U >
|
||||||
|
requires std::is_same_v<U, typename T::index_type>
|
||||||
|
[[nodiscard]] bool operator!=(const T& l, const U& r) noexcept {
|
||||||
|
return !(l == r);
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename T, detail::state_family U >
|
||||||
|
requires std::is_same_v<T, typename U::index_type>
|
||||||
|
[[nodiscard]] bool operator!=(const T& l, const U& r) noexcept {
|
||||||
|
return !(l == r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
{
|
{
|
||||||
struct argument_state final {
|
struct argument_state final {
|
||||||
|
|||||||
118
develop/untests/meta_states/ops_tests.cpp
Normal file
118
develop/untests/meta_states/ops_tests.cpp
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* This file is part of the "https://github.com/blackmatov/meta.hpp"
|
||||||
|
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||||
|
* Copyright (C) 2021-2023, by Matvey Cherevko (blackmatov@gmail.com)
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "../meta_untests.hpp"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("meta/meta_states/ops") {
|
||||||
|
namespace meta = meta_hpp;
|
||||||
|
|
||||||
|
SUBCASE("operator<") {
|
||||||
|
// NOLINTBEGIN(*-redundant-expression)
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::argument>() < std::declval<meta::argument>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::constructor>() < std::declval<meta::constructor>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::destructor>() < std::declval<meta::destructor>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::evalue>() < std::declval<meta::evalue>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::function>() < std::declval<meta::function>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::member>() < std::declval<meta::member>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::method>() < std::declval<meta::method>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::scope>() < std::declval<meta::scope>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::variable>() < std::declval<meta::variable>())>);
|
||||||
|
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::argument>() < std::declval<meta::argument::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::constructor>() < std::declval<meta::constructor::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::destructor>() < std::declval<meta::destructor::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::evalue>() < std::declval<meta::evalue::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::function>() < std::declval<meta::function::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::member>() < std::declval<meta::member::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::method>() < std::declval<meta::method::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::scope>() < std::declval<meta::scope::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::variable>() < std::declval<meta::variable::index_type>())>);
|
||||||
|
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::argument::index_type>() < std::declval<meta::argument>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::constructor::index_type>() < std::declval<meta::constructor>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::destructor::index_type>() < std::declval<meta::destructor>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::evalue::index_type>() < std::declval<meta::evalue>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::function::index_type>() < std::declval<meta::function>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::member::index_type>() < std::declval<meta::member>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::method::index_type>() < std::declval<meta::method>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::scope::index_type>() < std::declval<meta::scope>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::variable::index_type>() < std::declval<meta::variable>())>);
|
||||||
|
// NOLINTEND(*-redundant-expression)
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("operator==") {
|
||||||
|
// NOLINTBEGIN(*-redundant-expression)
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::argument>() == std::declval<meta::argument>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::constructor>() == std::declval<meta::constructor>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::destructor>() == std::declval<meta::destructor>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::evalue>() == std::declval<meta::evalue>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::function>() == std::declval<meta::function>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::member>() == std::declval<meta::member>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::method>() == std::declval<meta::method>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::scope>() == std::declval<meta::scope>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::variable>() == std::declval<meta::variable>())>);
|
||||||
|
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::argument>() == std::declval<meta::argument::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::constructor>() == std::declval<meta::constructor::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::destructor>() == std::declval<meta::destructor::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::evalue>() == std::declval<meta::evalue::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::function>() == std::declval<meta::function::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::member>() == std::declval<meta::member::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::method>() == std::declval<meta::method::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::scope>() == std::declval<meta::scope::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::variable>() == std::declval<meta::variable::index_type>())>);
|
||||||
|
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::argument::index_type>() == std::declval<meta::argument>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::constructor::index_type>() == std::declval<meta::constructor>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::destructor::index_type>() == std::declval<meta::destructor>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::evalue::index_type>() == std::declval<meta::evalue>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::function::index_type>() == std::declval<meta::function>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::member::index_type>() == std::declval<meta::member>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::method::index_type>() == std::declval<meta::method>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::scope::index_type>() == std::declval<meta::scope>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::variable::index_type>() == std::declval<meta::variable>())>);
|
||||||
|
// NOLINTEND(*-redundant-expression)
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("operator!=") {
|
||||||
|
// NOLINTBEGIN(*-redundant-expression)
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::argument>() != std::declval<meta::argument>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::constructor>() != std::declval<meta::constructor>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::destructor>() != std::declval<meta::destructor>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::evalue>() != std::declval<meta::evalue>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::function>() != std::declval<meta::function>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::member>() != std::declval<meta::member>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::method>() != std::declval<meta::method>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::scope>() != std::declval<meta::scope>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::variable>() != std::declval<meta::variable>())>);
|
||||||
|
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::argument>() != std::declval<meta::argument::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::constructor>() != std::declval<meta::constructor::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::destructor>() != std::declval<meta::destructor::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::evalue>() != std::declval<meta::evalue::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::function>() != std::declval<meta::function::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::member>() != std::declval<meta::member::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::method>() != std::declval<meta::method::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::scope>() != std::declval<meta::scope::index_type>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::variable>() != std::declval<meta::variable::index_type>())>);
|
||||||
|
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::argument::index_type>() != std::declval<meta::argument>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::constructor::index_type>() != std::declval<meta::constructor>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::destructor::index_type>() != std::declval<meta::destructor>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::evalue::index_type>() != std::declval<meta::evalue>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::function::index_type>() != std::declval<meta::function>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::member::index_type>() != std::declval<meta::member>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::method::index_type>() != std::declval<meta::method>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::scope::index_type>() != std::declval<meta::scope>())>);
|
||||||
|
static_assert(std::is_same_v<bool, decltype(std::declval<meta::variable::index_type>() != std::declval<meta::variable>())>);
|
||||||
|
// NOLINTEND(*-redundant-expression)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -105,6 +105,8 @@ namespace meta_hpp
|
|||||||
{
|
{
|
||||||
class argument final {
|
class argument final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = argument_index;
|
||||||
|
|
||||||
explicit argument() = default;
|
explicit argument() = default;
|
||||||
explicit argument(detail::argument_state_ptr state) noexcept;
|
explicit argument(detail::argument_state_ptr state) noexcept;
|
||||||
argument& operator=(detail::argument_state_ptr state) noexcept;
|
argument& operator=(detail::argument_state_ptr state) noexcept;
|
||||||
@@ -126,8 +128,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class constructor final {
|
class constructor final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = constructor_index;
|
||||||
|
|
||||||
explicit constructor() = default;
|
explicit constructor() = default;
|
||||||
explicit constructor(detail::constructor_state_ptr state) noexcept;
|
constructor(detail::constructor_state_ptr state) noexcept;
|
||||||
constructor& operator=(detail::constructor_state_ptr state) noexcept;
|
constructor& operator=(detail::constructor_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -159,8 +163,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class destructor final {
|
class destructor final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = destructor_index;
|
||||||
|
|
||||||
explicit destructor() = default;
|
explicit destructor() = default;
|
||||||
explicit destructor(detail::destructor_state_ptr state) noexcept;
|
destructor(detail::destructor_state_ptr state) noexcept;
|
||||||
destructor& operator=(detail::destructor_state_ptr state) noexcept;
|
destructor& operator=(detail::destructor_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -182,8 +188,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class evalue final {
|
class evalue final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = evalue_index;
|
||||||
|
|
||||||
explicit evalue() = default;
|
explicit evalue() = default;
|
||||||
explicit evalue(detail::evalue_state_ptr state) noexcept;
|
evalue(detail::evalue_state_ptr state) noexcept;
|
||||||
evalue& operator=(detail::evalue_state_ptr state) noexcept;
|
evalue& operator=(detail::evalue_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -210,8 +218,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class function final {
|
class function final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = function_index;
|
||||||
|
|
||||||
explicit function() = default;
|
explicit function() = default;
|
||||||
explicit function(detail::function_state_ptr state) noexcept;
|
function(detail::function_state_ptr state) noexcept;
|
||||||
function& operator=(detail::function_state_ptr state) noexcept;
|
function& operator=(detail::function_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -244,8 +254,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class member final {
|
class member final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = member_index;
|
||||||
|
|
||||||
explicit member() = default;
|
explicit member() = default;
|
||||||
explicit member(detail::member_state_ptr state) noexcept;
|
member(detail::member_state_ptr state) noexcept;
|
||||||
member& operator=(detail::member_state_ptr state) noexcept;
|
member& operator=(detail::member_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -290,8 +302,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class method final {
|
class method final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = method_index;
|
||||||
|
|
||||||
explicit method() = default;
|
explicit method() = default;
|
||||||
explicit method(detail::method_state_ptr state) noexcept;
|
method(detail::method_state_ptr state) noexcept;
|
||||||
method& operator=(detail::method_state_ptr state) noexcept;
|
method& operator=(detail::method_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -324,6 +338,8 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class scope final {
|
class scope final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = scope_index;
|
||||||
|
|
||||||
explicit scope() = default;
|
explicit scope() = default;
|
||||||
explicit scope(detail::scope_state_ptr state) noexcept;
|
explicit scope(detail::scope_state_ptr state) noexcept;
|
||||||
scope& operator=(detail::scope_state_ptr state) noexcept;
|
scope& operator=(detail::scope_state_ptr state) noexcept;
|
||||||
@@ -357,8 +373,10 @@ namespace meta_hpp
|
|||||||
|
|
||||||
class variable final {
|
class variable final {
|
||||||
public:
|
public:
|
||||||
|
using index_type = variable_index;
|
||||||
|
|
||||||
explicit variable() = default;
|
explicit variable() = default;
|
||||||
explicit variable(detail::variable_state_ptr state) noexcept;
|
variable(detail::variable_state_ptr state) noexcept;
|
||||||
variable& operator=(detail::variable_state_ptr state) noexcept;
|
variable& operator=(detail::variable_state_ptr state) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] bool is_valid() const noexcept;
|
[[nodiscard]] bool is_valid() const noexcept;
|
||||||
@@ -428,6 +446,45 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace meta_hpp
|
||||||
|
{
|
||||||
|
template < detail::state_family T, typename U >
|
||||||
|
requires std::is_same_v<U, typename T::index_type>
|
||||||
|
[[nodiscard]] bool operator<(const T& l, const U& r) noexcept {
|
||||||
|
return !static_cast<bool>(l) || l.get_index() < r;
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename T, detail::state_family U >
|
||||||
|
requires std::is_same_v<T, typename U::index_type>
|
||||||
|
[[nodiscard]] bool operator<(const T& l, const U& r) noexcept {
|
||||||
|
return static_cast<bool>(r) && l < r.get_index();
|
||||||
|
}
|
||||||
|
|
||||||
|
template < detail::state_family T, typename U >
|
||||||
|
requires std::is_same_v<U, typename T::index_type>
|
||||||
|
[[nodiscard]] bool operator==(const T& l, const U& r) noexcept {
|
||||||
|
return static_cast<bool>(l) || l.get_index() == r;
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename T, detail::state_family U >
|
||||||
|
requires std::is_same_v<T, typename U::index_type>
|
||||||
|
[[nodiscard]] bool operator==(const T& l, const U& r) noexcept {
|
||||||
|
return static_cast<bool>(r) && l == r.get_index();
|
||||||
|
}
|
||||||
|
|
||||||
|
template < detail::state_family T, typename U >
|
||||||
|
requires std::is_same_v<U, typename T::index_type>
|
||||||
|
[[nodiscard]] bool operator!=(const T& l, const U& r) noexcept {
|
||||||
|
return !(l == r);
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename T, detail::state_family U >
|
||||||
|
requires std::is_same_v<T, typename U::index_type>
|
||||||
|
[[nodiscard]] bool operator!=(const T& l, const U& r) noexcept {
|
||||||
|
return !(l == r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace meta_hpp::detail
|
namespace meta_hpp::detail
|
||||||
{
|
{
|
||||||
struct argument_state final {
|
struct argument_state final {
|
||||||
|
|||||||
Reference in New Issue
Block a user