mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-16 14:09:02 +07:00
42
.github/workflows/darwin.yml
vendored
42
.github/workflows/darwin.yml
vendored
@@ -9,26 +9,26 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
# https://github.com/actions/virtual-environments/tree/main/images/macos
|
||||
- { os: "macos-12", xcode: "14.0", arch: "x64" }
|
||||
- { os: "macos-12", xcode: "14.1", arch: "x64" }
|
||||
- { os: "macos-12", xcode: "14.2", arch: "x64" }
|
||||
# https://github.com/actions/virtual-environments/tree/main/images/macos
|
||||
- { os: "macos-12", xcode: "14.0", arch: "x64" }
|
||||
- { os: "macos-12", xcode: "14.1", arch: "x64" }
|
||||
- { os: "macos-12", xcode: "14.2", arch: "x64" }
|
||||
name: "xcode-${{matrix.config.xcode}}"
|
||||
steps:
|
||||
- name: Setup
|
||||
run: |
|
||||
brew update
|
||||
brew install cmake ninja
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Select Xcode
|
||||
run: sudo xcode-select --switch "/Applications/Xcode_${{matrix.config.xcode}}.app"
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --preset macos-${{matrix.config.arch}}
|
||||
cmake --build --preset macos-${{matrix.config.arch}}-release
|
||||
- name: Test
|
||||
run: |
|
||||
ctest --preset macos-${{matrix.config.arch}}-release
|
||||
- name: Setup
|
||||
run: |
|
||||
brew update
|
||||
brew install cmake ninja
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Select Xcode
|
||||
run: sudo xcode-select --switch "/Applications/Xcode_${{matrix.config.xcode}}.app"
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --preset macos-${{matrix.config.arch}}
|
||||
cmake --build --preset macos-${{matrix.config.arch}}-release
|
||||
- name: Test
|
||||
run: |
|
||||
ctest --preset macos-${{matrix.config.arch}}
|
||||
|
||||
40
.github/workflows/linux.yml
vendored
40
.github/workflows/linux.yml
vendored
@@ -9,25 +9,25 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
# https://github.com/actions/virtual-environments/tree/main/images/linux
|
||||
- { os: "ubuntu-20.04", cc: "gcc-10", cxx: "g++-10" }
|
||||
- { os: "ubuntu-20.04", cc: "clang-10", cxx: "clang++-10" }
|
||||
- { os: "ubuntu-22.04", cc: "gcc-12", cxx: "g++-12" }
|
||||
- { os: "ubuntu-22.04", cc: "clang-14", cxx: "clang++-14" }
|
||||
# https://github.com/actions/virtual-environments/tree/main/images/linux
|
||||
- { os: "ubuntu-20.04", cc: "gcc-10", cxx: "g++-10" }
|
||||
- { os: "ubuntu-20.04", cc: "clang-10", cxx: "clang++-10" }
|
||||
- { os: "ubuntu-22.04", cc: "gcc-12", cxx: "g++-12" }
|
||||
- { os: "ubuntu-22.04", cc: "clang-14", cxx: "clang++-14" }
|
||||
name: "${{matrix.config.cxx}}"
|
||||
steps:
|
||||
- name: Setup
|
||||
run: |
|
||||
sudo apt-get update -o Acquire::Retries=10
|
||||
sudo apt-get install -o Acquire::Retries=10 -y cmake ninja-build ${{matrix.config.cc}} ${{matrix.config.cxx}}
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --preset linux-${{matrix.config.cc}}
|
||||
cmake --build --preset linux-${{matrix.config.cc}}-release
|
||||
- name: Test
|
||||
run: |
|
||||
ctest --preset linux-${{matrix.config.cc}}-release
|
||||
- name: Setup
|
||||
run: |
|
||||
sudo apt-get update -o Acquire::Retries=10
|
||||
sudo apt-get install -o Acquire::Retries=10 -y cmake ninja-build ${{matrix.config.cc}} ${{matrix.config.cxx}}
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --preset linux-${{matrix.config.cc}}
|
||||
cmake --build --preset linux-${{matrix.config.cc}}-release
|
||||
- name: Test
|
||||
run: |
|
||||
ctest --preset linux-${{matrix.config.cc}}
|
||||
|
||||
40
.github/workflows/windows.yml
vendored
40
.github/workflows/windows.yml
vendored
@@ -9,25 +9,25 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
# https://github.com/actions/virtual-environments/tree/main/images/win
|
||||
- { os: "windows-2019", vc: "msvc2019", arch: "x86" }
|
||||
- { os: "windows-2019", vc: "msvc2019", arch: "x64" }
|
||||
- { os: "windows-2022", vc: "msvc2022", arch: "x86" }
|
||||
- { os: "windows-2022", vc: "msvc2022", arch: "x64" }
|
||||
# https://github.com/actions/virtual-environments/tree/main/images/win
|
||||
- { os: "windows-2019", vc: "msvc2019", arch: "x86" }
|
||||
- { os: "windows-2019", vc: "msvc2019", arch: "x64" }
|
||||
- { os: "windows-2022", vc: "msvc2022", arch: "x86" }
|
||||
- { os: "windows-2022", vc: "msvc2022", arch: "x64" }
|
||||
name: "${{matrix.config.vc}} ${{matrix.config.arch}}"
|
||||
steps:
|
||||
- name: Setup
|
||||
run: choco install cmake ninja
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Select MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}
|
||||
cmake --build --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}-release
|
||||
- name: Test
|
||||
run: |
|
||||
ctest --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}-release
|
||||
- name: Setup
|
||||
run: choco install cmake ninja
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Select MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}
|
||||
cmake --build --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}-release
|
||||
- name: Test
|
||||
run: |
|
||||
ctest --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
{
|
||||
"version": 3,
|
||||
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 21,
|
||||
"patch": 0
|
||||
},
|
||||
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "ninja-base",
|
||||
@@ -203,7 +201,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "linux-clang-10-debug",
|
||||
@@ -336,63 +333,91 @@
|
||||
"configurePreset": "windows-x64-msvc2022"
|
||||
}
|
||||
],
|
||||
|
||||
"testPresets": [
|
||||
{
|
||||
"name": "test-base",
|
||||
"hidden": true,
|
||||
"output": {
|
||||
"verbosity": "verbose"
|
||||
},
|
||||
"configuration": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-10-release",
|
||||
"name": "linux-clang-10",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "linux-clang-10"
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-14-release",
|
||||
"name": "linux-clang-14",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "linux-clang-14"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-10-release",
|
||||
"name": "linux-gcc-10",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "linux-gcc-10"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-12-release",
|
||||
"name": "linux-gcc-12",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "linux-gcc-12"
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-release",
|
||||
"name": "macos-arm64",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "macos-arm64"
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-release",
|
||||
"name": "macos-arm64-san",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "macos-arm64-san"
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-san-no-exceptions",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "macos-arm64-san-no-exceptions"
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-san-no-rtti",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "macos-arm64-san-no-rtti"
|
||||
},
|
||||
{
|
||||
"name": "macos-x64",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "macos-x64"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2019-release",
|
||||
"name": "macos-x64-san",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "macos-x64-san"
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-san-no-exceptions",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "macos-x64-san-no-exceptions"
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-san-no-rtti",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "macos-x64-san-no-rtti"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2019",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "windows-x86-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2019-release",
|
||||
"name": "windows-x64-msvc2019",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "windows-x64-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2022-release",
|
||||
"name": "windows-x86-msvc2022",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "windows-x86-msvc2022"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2022-release",
|
||||
"name": "windows-x64-msvc2022",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "windows-x64-msvc2022"
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
- type conversions
|
||||
- non-linear search of methods/functions/...
|
||||
- register base types by `META_HPP_ENABLE_POLY_INFO`
|
||||
- distinguish between function types and function pointer types
|
||||
- add the library version to sources
|
||||
- fix all includes to work with the library more flexible
|
||||
- `try_invoke`/`is_invocable` should return error codes
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace
|
||||
TEST_CASE("meta/meta_manuals/function/type") {
|
||||
namespace meta = meta_hpp;
|
||||
|
||||
// resolves a function type by pointer
|
||||
const meta::function_type add_function_type = meta::resolve_type(&add);
|
||||
// resolves a function type by reference
|
||||
const meta::function_type add_function_type = meta::resolve_type(add);
|
||||
|
||||
// also, it can be resolved by static function type declaration
|
||||
CHECK(add_function_type == meta::resolve_type<int(*)(int, int)>());
|
||||
CHECK(add_function_type == meta::resolve_type<int(int, int)>());
|
||||
|
||||
// checks a return value type
|
||||
CHECK(add_function_type.get_return_type() == meta::resolve_type<int>());
|
||||
@@ -55,7 +55,7 @@ TEST_CASE("meta/meta_manuals/function/usage") {
|
||||
CHECK(sub_function == math_scope.get_function_with<int, int>("sub"));
|
||||
|
||||
// checks a type of the found function
|
||||
CHECK(sub_function.get_type() == meta::resolve_type<int(*)(int, int)>());
|
||||
CHECK(sub_function.get_type() == meta::resolve_type<int(int, int)>());
|
||||
|
||||
// checks the ability to call the function with specific arguments
|
||||
CHECK(sub_function.is_invocable_with(60, 18));
|
||||
|
||||
@@ -504,18 +504,30 @@ namespace meta_hpp::detail
|
||||
|
||||
#ifdef __COUNTER__
|
||||
# define META_HPP_DEFER(...) \
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_defer_, __COUNTER__) { ::meta_hpp::detail::make_defer(__VA_ARGS__) }
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_defer_, __COUNTER__) { \
|
||||
::meta_hpp::detail::make_defer(__VA_ARGS__) \
|
||||
}
|
||||
# define META_HPP_ERROR_DEFER(...) \
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_error_defer_, __COUNTER__) { ::meta_hpp::detail::make_error_defer(__VA_ARGS__) }
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_error_defer_, __COUNTER__) { \
|
||||
::meta_hpp::detail::make_error_defer(__VA_ARGS__) \
|
||||
}
|
||||
# define META_HPP_RETURN_DEFER(...) \
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_return_defer_, __COUNTER__) { ::meta_hpp::detail::make_return_defer(__VA_ARGS__) }
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_return_defer_, __COUNTER__) { \
|
||||
::meta_hpp::detail::make_return_defer(__VA_ARGS__) \
|
||||
}
|
||||
#else
|
||||
# define META_HPP_DEFER(...) \
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_defer_, __LINE__) { ::meta_hpp::detail::make_defer(__VA_ARGS__) }
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_defer_, __LINE__) { \
|
||||
::meta_hpp::detail::make_defer(__VA_ARGS__) \
|
||||
}
|
||||
# define META_HPP_ERROR_DEFER(...) \
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_error_defer_, __LINE__) { ::meta_hpp::detail::make_error_defer(__VA_ARGS__) }
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_error_defer_, __LINE__) { \
|
||||
::meta_hpp::detail::make_error_defer(__VA_ARGS__) \
|
||||
}
|
||||
# define META_HPP_RETURN_DEFER(...) \
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_return_defer_, __LINE__) { ::meta_hpp::detail::make_return_defer(__VA_ARGS__) }
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_return_defer_, __LINE__) { \
|
||||
::meta_hpp::detail::make_return_defer(__VA_ARGS__) \
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(META_HPP_NO_EXCEPTIONS)
|
||||
@@ -697,10 +709,14 @@ namespace meta_hpp::detail
|
||||
{
|
||||
template < typename R, typename... Args >
|
||||
struct fixed_function<R(Args...)>::vtable_t final {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
|
||||
R (*const call)(const fixed_function& self, Args... args);
|
||||
void (*const move)(fixed_function& from, fixed_function& to) noexcept;
|
||||
void (*const destroy)(fixed_function& self);
|
||||
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < typename T >
|
||||
static T* buffer_cast(buffer_t& buffer) noexcept {
|
||||
// NOLINTNEXTLINE(*-reinterpret-cast)
|
||||
@@ -1502,7 +1518,7 @@ namespace meta_hpp::detail
|
||||
concept enum_kind = std::is_enum_v<T>;
|
||||
|
||||
template < typename T >
|
||||
concept function_pointer_kind = (std::is_pointer_v<T> && std::is_function_v<std::remove_pointer_t<T>>);
|
||||
concept function_kind = std::is_function_v<T>;
|
||||
|
||||
template < typename T >
|
||||
concept member_pointer_kind = std::is_member_object_pointer_v<T>;
|
||||
@@ -1517,7 +1533,7 @@ namespace meta_hpp::detail
|
||||
concept number_kind = std::is_arithmetic_v<T>;
|
||||
|
||||
template < typename T >
|
||||
concept pointer_kind = (std::is_pointer_v<T> && !std::is_function_v<std::remove_pointer_t<T>>);
|
||||
concept pointer_kind = std::is_pointer_v<T>;
|
||||
|
||||
template < typename T >
|
||||
concept reference_kind = std::is_reference_v<T>;
|
||||
@@ -1529,7 +1545,13 @@ namespace meta_hpp::detail
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < typename T >
|
||||
concept non_pointer_kind = (!pointer_kind<T>);
|
||||
concept non_pointer_kind = !std::is_pointer_v<T>;
|
||||
|
||||
template < typename T >
|
||||
concept function_pointer_kind = std::is_pointer_v<T> && std::is_function_v<std::remove_pointer_t<T>>;
|
||||
|
||||
template < typename T >
|
||||
concept non_function_pointer_kind = std::is_pointer_v<T> && !std::is_function_v<std::remove_pointer_t<T>>;
|
||||
}
|
||||
|
||||
namespace meta_hpp::detail
|
||||
@@ -1556,7 +1578,7 @@ namespace meta_hpp::detail
|
||||
if constexpr ( array_kind<T> ) { return type_kind::array_; }
|
||||
if constexpr ( class_kind<T> ) { return type_kind::class_; }
|
||||
if constexpr ( enum_kind<T> ) { return type_kind::enum_; }
|
||||
if constexpr ( function_pointer_kind<T> ) { return type_kind::function_; }
|
||||
if constexpr ( function_kind<T> ) { return type_kind::function_; }
|
||||
if constexpr ( member_pointer_kind<T> ) { return type_kind::member_; }
|
||||
if constexpr ( method_pointer_kind<T> ) { return type_kind::method_; }
|
||||
if constexpr ( nullptr_kind<T> ) { return type_kind::nullptr_; }
|
||||
@@ -1652,7 +1674,7 @@ namespace meta_hpp
|
||||
|| std::is_same_v<T, uvalue>; //
|
||||
|
||||
template < typename T >
|
||||
concept non_uvalue_family = (!uvalue_family<T>);
|
||||
concept non_uvalue_family = !uvalue_family<T>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2021,11 +2043,11 @@ namespace meta_hpp::detail
|
||||
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < function_pointer_kind Function >
|
||||
template < function_kind Function >
|
||||
struct function_traits;
|
||||
|
||||
template < typename R, typename... Args >
|
||||
struct function_traits<R (*)(Args...)> {
|
||||
struct function_traits<R(Args...)> {
|
||||
static constexpr std::size_t arity{sizeof...(Args)};
|
||||
|
||||
using return_type = R;
|
||||
@@ -2037,7 +2059,7 @@ namespace meta_hpp::detail
|
||||
};
|
||||
|
||||
template < typename R, typename... Args >
|
||||
struct function_traits<R (*)(Args...) noexcept> : function_traits<R (*)(Args...)> {
|
||||
struct function_traits<R(Args...) noexcept> : function_traits<R(Args...)> {
|
||||
[[nodiscard]] static constexpr function_bitflags make_flags() noexcept {
|
||||
return function_flags::is_noexcept;
|
||||
}
|
||||
@@ -2867,7 +2889,9 @@ namespace meta_hpp
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
struct type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const type_kind kind;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
metadata_map metadata{};
|
||||
|
||||
@@ -2884,19 +2908,23 @@ namespace meta_hpp::detail
|
||||
};
|
||||
|
||||
struct array_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const array_bitflags flags;
|
||||
const std::size_t extent;
|
||||
const any_type data_type;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < array_kind Array >
|
||||
explicit array_type_data(type_list<Array>);
|
||||
};
|
||||
|
||||
struct class_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const class_bitflags flags;
|
||||
const std::size_t size;
|
||||
const std::size_t align;
|
||||
const any_type_list argument_types;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
class_list base_classes;
|
||||
class_list derived_classes;
|
||||
@@ -2951,25 +2979,31 @@ namespace meta_hpp::detail
|
||||
};
|
||||
|
||||
struct constructor_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const constructor_bitflags flags;
|
||||
const class_type owner_type;
|
||||
const any_type_list argument_types;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < class_kind Class, typename... Args >
|
||||
explicit constructor_type_data(type_list<Class>, type_list<Args...>);
|
||||
};
|
||||
|
||||
struct destructor_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const destructor_bitflags flags;
|
||||
const class_type owner_type;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < class_kind Class >
|
||||
explicit destructor_type_data(type_list<Class>);
|
||||
};
|
||||
|
||||
struct enum_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const enum_bitflags flags;
|
||||
const number_type underlying_type;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
evalue_list evalues;
|
||||
|
||||
@@ -2978,28 +3012,34 @@ namespace meta_hpp::detail
|
||||
};
|
||||
|
||||
struct function_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const function_bitflags flags;
|
||||
const any_type return_type;
|
||||
const any_type_list argument_types;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < function_pointer_kind Function >
|
||||
template < function_kind Function >
|
||||
explicit function_type_data(type_list<Function>);
|
||||
};
|
||||
|
||||
struct member_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const member_bitflags flags;
|
||||
const class_type owner_type;
|
||||
const any_type value_type;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < member_pointer_kind Member >
|
||||
explicit member_type_data(type_list<Member>);
|
||||
};
|
||||
|
||||
struct method_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const method_bitflags flags;
|
||||
const class_type owner_type;
|
||||
const any_type return_type;
|
||||
const any_type_list argument_types;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < method_pointer_kind Method >
|
||||
explicit method_type_data(type_list<Method>);
|
||||
@@ -3011,25 +3051,31 @@ namespace meta_hpp::detail
|
||||
};
|
||||
|
||||
struct number_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const number_bitflags flags;
|
||||
const std::size_t size;
|
||||
const std::size_t align;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < number_kind Number >
|
||||
explicit number_type_data(type_list<Number>);
|
||||
};
|
||||
|
||||
struct pointer_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const pointer_bitflags flags;
|
||||
const any_type data_type;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < pointer_kind Pointer >
|
||||
explicit pointer_type_data(type_list<Pointer>);
|
||||
};
|
||||
|
||||
struct reference_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const reference_bitflags flags;
|
||||
const any_type data_type;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < reference_kind Reference >
|
||||
explicit reference_type_data(type_list<Reference>);
|
||||
@@ -4178,7 +4224,7 @@ namespace meta_hpp::detail
|
||||
if constexpr ( array_kind<T> ) { return resolve_array_type<T>(); }
|
||||
if constexpr ( class_kind<T> ) { return resolve_class_type<T>(); }
|
||||
if constexpr ( enum_kind<T> ) { return resolve_enum_type<T>(); }
|
||||
if constexpr ( function_pointer_kind<T> ) { return resolve_function_type<T>(); }
|
||||
if constexpr ( function_kind<T> ) { return resolve_function_type<T>(); }
|
||||
if constexpr ( member_pointer_kind<T> ) { return resolve_member_type<T>(); }
|
||||
if constexpr ( method_pointer_kind<T> ) { return resolve_method_type<T>(); }
|
||||
if constexpr ( nullptr_kind<T> ) { return resolve_nullptr_type<T>(); }
|
||||
@@ -4225,7 +4271,7 @@ namespace meta_hpp::detail
|
||||
return type;
|
||||
}
|
||||
|
||||
template < function_pointer_kind Function >
|
||||
template < function_kind Function >
|
||||
[[nodiscard]] function_type resolve_function_type() {
|
||||
using function_t = std::remove_cv_t<Function>;
|
||||
static function_type type{ensure_type<function_type_data>(type_list<function_t>{})};
|
||||
@@ -4716,7 +4762,7 @@ namespace meta_hpp
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < detail::function_pointer_kind Function >
|
||||
template < detail::function_kind Function >
|
||||
class function_bind final : public type_bind_base<function_type> {
|
||||
public:
|
||||
explicit function_bind(metadata_map metadata);
|
||||
@@ -4835,7 +4881,7 @@ namespace meta_hpp
|
||||
return enum_bind<Enum>{std::move(metadata)};
|
||||
}
|
||||
|
||||
template < detail::function_pointer_kind Function >
|
||||
template < detail::function_kind Function >
|
||||
function_bind<Function> function_(metadata_map metadata = {}) {
|
||||
return function_bind<Function>{std::move(metadata)};
|
||||
}
|
||||
@@ -5263,7 +5309,7 @@ namespace meta_hpp
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < detail::function_pointer_kind Function >
|
||||
template < detail::function_kind Function >
|
||||
function_bind<Function>::function_bind(metadata_map metadata)
|
||||
: type_bind_base{resolve_type<Function>(), std::move(metadata)} {}
|
||||
}
|
||||
@@ -5713,12 +5759,12 @@ namespace meta_hpp::detail
|
||||
template < typename T, typename Tp = std::decay_t<T> >
|
||||
concept arg_lvalue_ref_kind //
|
||||
= (non_uvalue_family<Tp>) //
|
||||
&& (std::is_lvalue_reference_v<T>);
|
||||
&&(std::is_lvalue_reference_v<T>);
|
||||
|
||||
template < typename T, typename Tp = std::decay_t<T> >
|
||||
concept arg_rvalue_ref_kind //
|
||||
= (non_uvalue_family<Tp>) //
|
||||
&& (!std::is_reference_v<T> || std::is_rvalue_reference_v<T>);
|
||||
&&(!std::is_reference_v<T> || std::is_rvalue_reference_v<T>);
|
||||
}
|
||||
|
||||
namespace meta_hpp::detail
|
||||
@@ -5731,14 +5777,14 @@ namespace meta_hpp::detail
|
||||
template < typename T, typename Tp = std::decay_t<T> >
|
||||
concept inst_class_lvalue_ref_kind //
|
||||
= (non_uvalue_family<Tp>) //
|
||||
&& (std::is_lvalue_reference_v<T>) //
|
||||
&& (std::is_class_v<std::remove_pointer_t<std::remove_reference_t<T>>>);
|
||||
&&(std::is_lvalue_reference_v<T>) //
|
||||
&&(std::is_class_v<std::remove_pointer_t<std::remove_reference_t<T>>>);
|
||||
|
||||
template < typename T, typename Tp = std::decay_t<T> >
|
||||
concept inst_class_rvalue_ref_kind //
|
||||
= (non_uvalue_family<Tp>) //
|
||||
&& (!std::is_reference_v<T> || std::is_rvalue_reference_v<T>) //
|
||||
&& (std::is_class_v<std::remove_pointer_t<std::remove_reference_t<T>>>);
|
||||
&&(!std::is_reference_v<T> || std::is_rvalue_reference_v<T>) //
|
||||
&&(std::is_class_v<std::remove_pointer_t<std::remove_reference_t<T>>>);
|
||||
}
|
||||
|
||||
namespace meta_hpp::detail
|
||||
@@ -5963,10 +6009,11 @@ namespace meta_hpp::detail
|
||||
return raw_type_;
|
||||
}
|
||||
|
||||
template < pointer_kind To >
|
||||
template < non_function_pointer_kind To >
|
||||
[[nodiscard]] bool can_cast_to(type_registry& registry) const noexcept;
|
||||
|
||||
template < non_pointer_kind To >
|
||||
template < typename To >
|
||||
requires(!non_function_pointer_kind<To>)
|
||||
[[nodiscard]] bool can_cast_to(type_registry& registry) const noexcept;
|
||||
|
||||
private:
|
||||
@@ -6005,10 +6052,11 @@ namespace meta_hpp::detail
|
||||
: uarg_base{registry, std::forward<T>(v)}
|
||||
, data_{const_cast<std::remove_cvref_t<T>*>(std::addressof(v))} {} // NOLINT(*-const-cast)
|
||||
|
||||
template < pointer_kind To >
|
||||
template < non_function_pointer_kind To >
|
||||
[[nodiscard]] decltype(auto) cast(type_registry& registry) const;
|
||||
|
||||
template < non_pointer_kind To >
|
||||
template < typename To >
|
||||
requires(!non_function_pointer_kind<To>)
|
||||
[[nodiscard]] decltype(auto) cast(type_registry& registry) const;
|
||||
|
||||
private:
|
||||
@@ -6018,7 +6066,7 @@ namespace meta_hpp::detail
|
||||
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < pointer_kind To >
|
||||
template < non_function_pointer_kind To >
|
||||
[[nodiscard]] bool uarg_base::can_cast_to(type_registry& registry) const noexcept {
|
||||
using to_raw_type = std::remove_cv_t<To>;
|
||||
|
||||
@@ -6064,7 +6112,8 @@ namespace meta_hpp::detail
|
||||
return false;
|
||||
}
|
||||
|
||||
template < non_pointer_kind To >
|
||||
template < typename To >
|
||||
requires(!non_function_pointer_kind<To>)
|
||||
[[nodiscard]] bool uarg_base::can_cast_to(type_registry& registry) const noexcept {
|
||||
using to_raw_type_cv = std::remove_reference_t<To>;
|
||||
using to_raw_type = std::remove_cv_t<to_raw_type_cv>;
|
||||
@@ -6111,7 +6160,7 @@ namespace meta_hpp::detail
|
||||
}
|
||||
}
|
||||
|
||||
if constexpr ( non_pointer_kind<To> && !std::is_reference_v<To> ) {
|
||||
if constexpr ( !std::is_reference_v<To> ) {
|
||||
if ( is_a(to_type, from_type) && is_constructible_from_type(type_list<to_raw_type>{}) ) {
|
||||
return true;
|
||||
}
|
||||
@@ -6123,7 +6172,7 @@ namespace meta_hpp::detail
|
||||
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < pointer_kind To >
|
||||
template < non_function_pointer_kind To >
|
||||
[[nodiscard]] decltype(auto) uarg::cast(type_registry& registry) const {
|
||||
META_HPP_DEV_ASSERT(can_cast_to<To>(registry) && "bad argument cast");
|
||||
|
||||
@@ -6165,7 +6214,8 @@ namespace meta_hpp::detail
|
||||
throw_exception(error_code::bad_argument_cast);
|
||||
}
|
||||
|
||||
template < non_pointer_kind To >
|
||||
template < typename To >
|
||||
requires(!non_function_pointer_kind<To>)
|
||||
[[nodiscard]] decltype(auto) uarg::cast(type_registry& registry) const {
|
||||
META_HPP_DEV_ASSERT(can_cast_to<To>(registry) && "bad argument cast");
|
||||
|
||||
@@ -6226,10 +6276,9 @@ namespace meta_hpp::detail
|
||||
if ( args.size() != type_list_arity_v<ArgTypeList> ) {
|
||||
return false;
|
||||
}
|
||||
return [ args, ®istry ]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
return [args, ®istry]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
return (... && args[Is].can_cast_to<type_list_at_t<Is, ArgTypeList>>(registry));
|
||||
}
|
||||
(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
|
||||
}(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
|
||||
}
|
||||
|
||||
template < typename ArgTypeList >
|
||||
@@ -6237,25 +6286,23 @@ namespace meta_hpp::detail
|
||||
if ( args.size() != type_list_arity_v<ArgTypeList> ) {
|
||||
return false;
|
||||
}
|
||||
return [ args, ®istry ]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
return [args, ®istry]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
return (... && args[Is].can_cast_to<type_list_at_t<Is, ArgTypeList>>(registry));
|
||||
}
|
||||
(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
|
||||
}(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
|
||||
}
|
||||
|
||||
template < typename ArgTypeList, typename F >
|
||||
auto unchecked_call_with_uargs(type_registry& registry, std::span<const uarg> args, F&& f) {
|
||||
META_HPP_DEV_ASSERT(args.size() == type_list_arity_v<ArgTypeList>);
|
||||
return [ args, ®istry, &f ]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
return [args, ®istry, &f]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
return f(args[Is].cast<type_list_at_t<Is, ArgTypeList>>(registry)...);
|
||||
}
|
||||
(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
|
||||
}(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < function_pointer_kind Function >
|
||||
template < function_kind Function >
|
||||
function_type_data::function_type_data(type_list<Function>)
|
||||
: type_data_base{type_kind::function_}
|
||||
, flags{function_traits<Function>::make_flags()}
|
||||
@@ -6290,7 +6337,7 @@ namespace meta_hpp::detail
|
||||
{
|
||||
template < function_policy_family Policy, function_pointer_kind Function >
|
||||
uvalue raw_function_invoke(type_registry& registry, Function function_ptr, std::span<const uarg> args) {
|
||||
using ft = function_traits<Function>;
|
||||
using ft = function_traits<std::remove_pointer_t<Function>>;
|
||||
using return_type = typename ft::return_type;
|
||||
using argument_types = typename ft::argument_types;
|
||||
|
||||
@@ -6338,7 +6385,7 @@ namespace meta_hpp::detail
|
||||
|
||||
template < function_pointer_kind Function >
|
||||
uerror raw_function_invoke_error(type_registry& registry, std::span<const uarg_base> args) noexcept {
|
||||
using ft = function_traits<Function>;
|
||||
using ft = function_traits<std::remove_pointer_t<Function>>;
|
||||
using argument_types = typename ft::argument_types;
|
||||
|
||||
if ( args.size() != ft::arity ) {
|
||||
@@ -6371,7 +6418,7 @@ namespace meta_hpp::detail
|
||||
|
||||
template < function_pointer_kind Function >
|
||||
argument_list make_function_arguments() {
|
||||
using ft = function_traits<Function>;
|
||||
using ft = function_traits<std::remove_pointer_t<Function>>;
|
||||
using ft_argument_types = typename ft::argument_types;
|
||||
|
||||
return []<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
@@ -6380,8 +6427,7 @@ namespace meta_hpp::detail
|
||||
return argument{argument_state::make<P>(I, metadata_map{})};
|
||||
};
|
||||
return argument_list{make_argument(index_constant<Is>{})...};
|
||||
}
|
||||
(std::make_index_sequence<ft::arity>());
|
||||
}(std::make_index_sequence<ft::arity>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6394,10 +6440,16 @@ namespace meta_hpp::detail
|
||||
template < function_policy_family Policy, function_pointer_kind Function >
|
||||
function_state_ptr function_state::make(std::string name, Function function_ptr, metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
function_state state{function_index{registry.resolve_type<Function>(), std::move(name)}, std::move(metadata)};
|
||||
|
||||
function_state state{
|
||||
function_index{registry.resolve_type<std::remove_pointer_t<Function>>(), std::move(name)},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.invoke = make_function_invoke<Policy>(registry, function_ptr);
|
||||
state.invoke_error = make_function_invoke_error<Function>(registry);
|
||||
state.arguments = make_function_arguments<Function>();
|
||||
|
||||
return make_intrusive<function_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
@@ -6899,11 +6951,17 @@ namespace meta_hpp::detail
|
||||
template < member_policy_family Policy, member_pointer_kind Member >
|
||||
member_state_ptr member_state::make(std::string name, Member member_ptr, metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
member_state state{member_index{registry.resolve_type<Member>(), std::move(name)}, std::move(metadata)};
|
||||
|
||||
member_state state{
|
||||
member_index{registry.resolve_type<Member>(), std::move(name)},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.getter = make_member_getter<Policy>(registry, member_ptr);
|
||||
state.setter = make_member_setter(registry, member_ptr);
|
||||
state.getter_error = make_member_getter_error<Member>(registry);
|
||||
state.setter_error = make_member_setter_error<Member>(registry);
|
||||
|
||||
return make_intrusive<member_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
@@ -7158,8 +7216,7 @@ namespace meta_hpp::detail
|
||||
return argument{argument_state::make<P>(I, metadata_map{})};
|
||||
};
|
||||
return argument_list{make_argument(index_constant<Is>{})...};
|
||||
}
|
||||
(std::make_index_sequence<mt::arity>());
|
||||
}(std::make_index_sequence<mt::arity>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7172,10 +7229,16 @@ namespace meta_hpp::detail
|
||||
template < method_policy_family Policy, method_pointer_kind Method >
|
||||
method_state_ptr method_state::make(std::string name, Method method_ptr, metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
method_state state{method_index{registry.resolve_type<Method>(), std::move(name)}, std::move(metadata)};
|
||||
|
||||
method_state state{
|
||||
method_index{registry.resolve_type<Method>(), std::move(name)},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.invoke = make_method_invoke<Policy>(registry, method_ptr);
|
||||
state.invoke_error = make_method_invoke_error<Method>(registry);
|
||||
state.arguments = make_method_arguments<Method>();
|
||||
|
||||
return make_intrusive<method_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
@@ -7461,7 +7524,12 @@ namespace meta_hpp::detail
|
||||
template < typename Argument >
|
||||
inline argument_state_ptr argument_state::make(std::size_t position, metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
argument_state state{argument_index{registry.resolve_type<Argument>(), position}, std::move(metadata)};
|
||||
|
||||
argument_state state{
|
||||
argument_index{registry.resolve_type<Argument>(), position},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
return make_intrusive<argument_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
@@ -7631,8 +7699,7 @@ namespace meta_hpp::detail
|
||||
return argument{argument_state::make<P>(I, metadata_map{})};
|
||||
};
|
||||
return argument_list{make_argument(index_constant<Is>{})...};
|
||||
}
|
||||
(std::make_index_sequence<ct::arity>());
|
||||
}(std::make_index_sequence<ct::arity>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7645,11 +7712,17 @@ namespace meta_hpp::detail
|
||||
template < constructor_policy_family Policy, class_kind Class, typename... Args >
|
||||
constructor_state_ptr constructor_state::make(metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
constructor_state state{constructor_index{registry.resolve_constructor_type<Class, Args...>()}, std::move(metadata)};
|
||||
|
||||
constructor_state state{
|
||||
constructor_index{registry.resolve_constructor_type<Class, Args...>()},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.create = make_constructor_create<Policy, Class, Args...>(registry);
|
||||
state.create_at = make_constructor_create_at<Class, Args...>(registry);
|
||||
state.create_error = make_constructor_create_error<Class, Args...>(registry);
|
||||
state.arguments = make_constructor_arguments<Class, Args...>();
|
||||
|
||||
return make_intrusive<constructor_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
@@ -7820,10 +7893,16 @@ namespace meta_hpp::detail
|
||||
template < class_kind Class >
|
||||
destructor_state_ptr destructor_state::make(metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
destructor_state state{destructor_index{registry.resolve_destructor_type<Class>()}, std::move(metadata)};
|
||||
|
||||
destructor_state state{
|
||||
destructor_index{registry.resolve_destructor_type<Class>()},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.destroy = make_destructor_destroy<Class>(registry);
|
||||
state.destroy_at = make_destructor_destroy_at<Class>();
|
||||
state.destroy_error = make_destructor_destroy_error<Class>(registry);
|
||||
|
||||
return make_intrusive<destructor_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
@@ -7950,9 +8029,15 @@ namespace meta_hpp::detail
|
||||
template < enum_kind Enum >
|
||||
evalue_state_ptr evalue_state::make(std::string name, Enum evalue, metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
evalue_state state{evalue_index{registry.resolve_type<Enum>(), std::move(name)}, std::move(metadata)};
|
||||
|
||||
evalue_state state{
|
||||
evalue_index{registry.resolve_type<Enum>(), std::move(name)},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.enum_value = uvalue{evalue};
|
||||
state.underlying_value = uvalue{to_underlying(evalue)};
|
||||
|
||||
return make_intrusive<evalue_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
@@ -8101,10 +8186,16 @@ namespace meta_hpp::detail
|
||||
template < variable_policy_family Policy, pointer_kind Pointer >
|
||||
variable_state_ptr variable_state::make(std::string name, Pointer variable_ptr, metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
variable_state state{variable_index{registry.resolve_type<Pointer>(), std::move(name)}, std::move(metadata)};
|
||||
|
||||
variable_state state{
|
||||
variable_index{registry.resolve_type<Pointer>(), std::move(name)},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.getter = make_variable_getter<Policy>(registry, variable_ptr);
|
||||
state.setter = make_variable_setter(registry, variable_ptr);
|
||||
state.setter_error = make_variable_setter_error<Pointer>(registry);
|
||||
|
||||
return make_intrusive<variable_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
@@ -8670,7 +8761,10 @@ namespace meta_hpp::detail
|
||||
, metadata{std::move(nmetadata)} {}
|
||||
|
||||
inline scope_state_ptr scope_state::make(std::string name, metadata_map metadata) {
|
||||
scope_state state{scope_index{std::move(name)}, std::move(metadata)};
|
||||
scope_state state{
|
||||
scope_index{std::move(name)},
|
||||
std::move(metadata),
|
||||
};
|
||||
return make_intrusive<scope_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
@@ -8985,11 +9079,11 @@ namespace meta_hpp::detail
|
||||
typename From,
|
||||
typename ToDT = std::remove_pointer_t<To>,
|
||||
typename FromDT = std::remove_pointer_t<From> >
|
||||
concept pointer_ucast_kind //
|
||||
= (std::is_pointer_v<From> && std::is_class_v<FromDT>) //
|
||||
&& (std::is_pointer_v<To> && (std::is_class_v<ToDT> || std::is_void_v<ToDT>)) //
|
||||
&& (!std::is_const_v<FromDT> || std::is_const_v<ToDT>) //
|
||||
&& (!std::is_volatile_v<FromDT> || std::is_volatile_v<ToDT>); //
|
||||
concept pointer_ucast_kind //
|
||||
= (std::is_pointer_v<From> && std::is_class_v<FromDT>) //
|
||||
&&(std::is_pointer_v<To> && (std::is_class_v<ToDT> || std::is_void_v<ToDT>)) //
|
||||
&& (!std::is_const_v<FromDT> || std::is_const_v<ToDT>) //
|
||||
&&(!std::is_volatile_v<FromDT> || std::is_volatile_v<ToDT>); //
|
||||
|
||||
template <
|
||||
typename To,
|
||||
@@ -8998,9 +9092,9 @@ namespace meta_hpp::detail
|
||||
typename FromDT = std::remove_reference_t<From> >
|
||||
concept lvalue_reference_ucast_kind //
|
||||
= (std::is_lvalue_reference_v<From> && std::is_class_v<FromDT>) //
|
||||
&& (std::is_lvalue_reference_v<To> && std::is_class_v<ToDT>) //
|
||||
&& (!std::is_const_v<FromDT> || std::is_const_v<ToDT>) //
|
||||
&& (!std::is_volatile_v<FromDT> || std::is_volatile_v<ToDT>); //
|
||||
&&(std::is_lvalue_reference_v<To> && std::is_class_v<ToDT>) //
|
||||
&&(!std::is_const_v<FromDT> || std::is_const_v<ToDT>) //
|
||||
&&(!std::is_volatile_v<FromDT> || std::is_volatile_v<ToDT>); //
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
@@ -9227,6 +9321,7 @@ namespace meta_hpp::detail
|
||||
namespace meta_hpp
|
||||
{
|
||||
struct uvalue::vtable_t final {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const any_type type;
|
||||
|
||||
void (*const move)(uvalue&& self, uvalue& to) noexcept;
|
||||
@@ -9236,6 +9331,7 @@ namespace meta_hpp
|
||||
uvalue (*const deref)(const storage_u& self);
|
||||
uvalue (*const index)(const storage_u& self, std::size_t i);
|
||||
uvalue (*const unmap)(const storage_u& self);
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < typename T >
|
||||
inline static constexpr bool in_internal_v = //
|
||||
|
||||
41
develop/untests/meta_issues/random_issue_3.cpp
Normal file
41
develop/untests/meta_issues/random_issue_3.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/*******************************************************************************
|
||||
* 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.hpp/meta_all.hpp>
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
int int_func() { return 0; }
|
||||
}
|
||||
|
||||
TEST_CASE("meta/meta_issues/random/3") {
|
||||
namespace meta = meta_hpp;
|
||||
|
||||
static_assert(std::is_same_v<decltype(meta::resolve_type<int()>()), meta_hpp::function_type>);
|
||||
static_assert(std::is_same_v<decltype(meta::resolve_type<int(*)()>()), meta_hpp::pointer_type>);
|
||||
static_assert(std::is_same_v<decltype(meta::resolve_type<int(&)()>()), meta_hpp::reference_type>);
|
||||
|
||||
static_assert(std::is_same_v<decltype(meta::resolve_type(int_func)), meta_hpp::function_type>);
|
||||
static_assert(std::is_same_v<decltype(meta::resolve_type(&int_func)), meta_hpp::pointer_type>);
|
||||
|
||||
CHECK(meta::resolve_type<int()>().get_kind() == meta::type_kind::function_);
|
||||
CHECK(meta::resolve_type<int(*)()>().get_kind() == meta::type_kind::pointer_);
|
||||
CHECK(meta::resolve_type<int(&)()>().get_kind() == meta::type_kind::reference_);
|
||||
|
||||
CHECK(meta::resolve_type(int_func).get_kind() == meta::type_kind::function_);
|
||||
CHECK(meta::resolve_type(&int_func).get_kind() == meta::type_kind::pointer_);
|
||||
|
||||
CHECK(meta::resolve_type<int(*)()>().get_data_type() == meta::resolve_type<int()>());
|
||||
CHECK(meta::resolve_type<int(&)()>().get_data_type() == meta::resolve_type<int()>());
|
||||
|
||||
{
|
||||
meta::uvalue v{&int_func};
|
||||
CHECK_FALSE(v.has_deref_op());
|
||||
CHECK(v.get_type() == meta::resolve_type<int(*)()>());
|
||||
CHECK((v.as<decltype(&int_func)>() == &int_func));
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ TEST_CASE("meta/meta_states/function") {
|
||||
CHECK(func.get_index().get_type() == func.get_type());
|
||||
CHECK(func.get_index().get_name() == "iadd");
|
||||
|
||||
CHECK(func.get_type() == meta::resolve_type(&ivec2::iadd));
|
||||
CHECK(func.get_type() == meta::resolve_type(ivec2::iadd));
|
||||
CHECK(func.get_name() == "iadd");
|
||||
|
||||
CHECK_FALSE(func.is_invocable_with<>());
|
||||
@@ -99,7 +99,7 @@ TEST_CASE("meta/meta_states/function") {
|
||||
CHECK(func.get_index().get_type() == func.get_type());
|
||||
CHECK(func.get_index().get_name() == "ilength2");
|
||||
|
||||
CHECK(func.get_type() == meta::resolve_type(&ivec2::ilength2));
|
||||
CHECK(func.get_type() == meta::resolve_type(ivec2::ilength2));
|
||||
CHECK(func.get_name() == "ilength2");
|
||||
|
||||
CHECK_FALSE(func.is_invocable_with<>());
|
||||
|
||||
@@ -269,10 +269,10 @@ TEST_CASE("meta/meta_states/metadata/other") {
|
||||
}
|
||||
|
||||
SUBCASE("function") {
|
||||
meta::function_<int(*)(int)>({
|
||||
meta::function_<int(int)>({
|
||||
{"desc", "int->int"s}
|
||||
});
|
||||
CHECK(meta::resolve_type<int(*)(int)>().get_metadata().at("desc").as<std::string>() == "int->int"s);
|
||||
CHECK(meta::resolve_type<int(int)>().get_metadata().at("desc").as<std::string>() == "int->int"s);
|
||||
}
|
||||
|
||||
SUBCASE("member") {
|
||||
|
||||
@@ -118,11 +118,11 @@ TEST_CASE("meta/meta_types/any_type") {
|
||||
}
|
||||
|
||||
SUBCASE("function") {
|
||||
const meta::any_type& type = meta::resolve_type(&function_v);
|
||||
const meta::any_type& type = meta::resolve_type(function_v);
|
||||
|
||||
REQUIRE(type);
|
||||
REQUIRE(type == meta::resolve_type<decltype(&function_v)>());
|
||||
REQUIRE(type.get_id() == meta::resolve_type<decltype(&function_v)>().get_id());
|
||||
REQUIRE(type == meta::resolve_type<decltype(function_v)>());
|
||||
REQUIRE(type.get_id() == meta::resolve_type<decltype(function_v)>().get_id());
|
||||
|
||||
CHECK(type.is_function());
|
||||
CHECK(type.get_kind() == meta::type_kind::function_);
|
||||
|
||||
@@ -34,10 +34,10 @@ TEST_CASE("meta/meta_types/function_type") {
|
||||
}
|
||||
|
||||
SUBCASE("arg_copy") {
|
||||
const meta::function_type type = meta::resolve_type(&arg_copy);
|
||||
const meta::function_type type = meta::resolve_type(arg_copy);
|
||||
REQUIRE(type);
|
||||
|
||||
CHECK(type.get_id() == meta::resolve_type(&arg_copy).get_id());
|
||||
CHECK(type.get_id() == meta::resolve_type(arg_copy).get_id());
|
||||
CHECK(type.get_flags() == meta::function_flags{});
|
||||
|
||||
CHECK(type.get_arity() == 1);
|
||||
@@ -49,10 +49,10 @@ TEST_CASE("meta/meta_types/function_type") {
|
||||
}
|
||||
|
||||
SUBCASE("arg_ref_noexcept") {
|
||||
const meta::function_type type = meta::resolve_type(&arg_ref_noexcept);
|
||||
const meta::function_type type = meta::resolve_type(arg_ref_noexcept);
|
||||
REQUIRE(type);
|
||||
|
||||
CHECK(type.get_id() == meta::resolve_type(&arg_ref_noexcept).get_id());
|
||||
CHECK(type.get_id() == meta::resolve_type(arg_ref_noexcept).get_id());
|
||||
CHECK(type.get_flags() == meta::function_flags::is_noexcept);
|
||||
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<ivec2&>()});
|
||||
|
||||
@@ -61,10 +61,10 @@ TEST_CASE("meta/meta_types/function_type") {
|
||||
}
|
||||
|
||||
SUBCASE("arg_cref_noexcept") {
|
||||
const meta::function_type type = meta::resolve_type(&arg_cref_noexcept);
|
||||
const meta::function_type type = meta::resolve_type(arg_cref_noexcept);
|
||||
REQUIRE(type);
|
||||
|
||||
CHECK(type.get_id() == meta::resolve_type(&arg_cref_noexcept).get_id());
|
||||
CHECK(type.get_id() == meta::resolve_type(arg_cref_noexcept).get_id());
|
||||
CHECK(type.get_flags() == meta::function_flags::is_noexcept);
|
||||
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<const ivec2&>()});
|
||||
|
||||
@@ -73,10 +73,10 @@ TEST_CASE("meta/meta_types/function_type") {
|
||||
}
|
||||
|
||||
SUBCASE("arg_bounded_arr") {
|
||||
const meta::function_type type = meta::resolve_type(&arg_bounded_arr);
|
||||
const meta::function_type type = meta::resolve_type(arg_bounded_arr);
|
||||
REQUIRE(type);
|
||||
|
||||
CHECK(type.get_id() == meta::resolve_type(&arg_bounded_arr).get_id());
|
||||
CHECK(type.get_id() == meta::resolve_type(arg_bounded_arr).get_id());
|
||||
CHECK(type.get_flags() == meta::function_flags{});
|
||||
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<ivec2*>()});
|
||||
|
||||
@@ -85,10 +85,10 @@ TEST_CASE("meta/meta_types/function_type") {
|
||||
}
|
||||
|
||||
SUBCASE("arg_unbounded_arr") {
|
||||
const meta::function_type type = meta::resolve_type(&arg_unbounded_arr);
|
||||
const meta::function_type type = meta::resolve_type(arg_unbounded_arr);
|
||||
REQUIRE(type);
|
||||
|
||||
CHECK(type.get_id() == meta::resolve_type(&arg_unbounded_arr).get_id());
|
||||
CHECK(type.get_id() == meta::resolve_type(arg_unbounded_arr).get_id());
|
||||
CHECK(type.get_flags() == meta::function_flags{});
|
||||
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<ivec2*>()});
|
||||
|
||||
@@ -97,10 +97,10 @@ TEST_CASE("meta/meta_types/function_type") {
|
||||
}
|
||||
|
||||
SUBCASE("arg_bounded_const_arr") {
|
||||
const meta::function_type type = meta::resolve_type(&arg_bounded_const_arr);
|
||||
const meta::function_type type = meta::resolve_type(arg_bounded_const_arr);
|
||||
REQUIRE(type);
|
||||
|
||||
CHECK(type.get_id() == meta::resolve_type(&arg_bounded_const_arr).get_id());
|
||||
CHECK(type.get_id() == meta::resolve_type(arg_bounded_const_arr).get_id());
|
||||
CHECK(type.get_flags() == meta::function_flags{});
|
||||
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<const ivec2*>()});
|
||||
|
||||
@@ -109,10 +109,10 @@ TEST_CASE("meta/meta_types/function_type") {
|
||||
}
|
||||
|
||||
SUBCASE("arg_unbounded_const_arr") {
|
||||
const meta::function_type type = meta::resolve_type(&arg_unbounded_const_arr);
|
||||
const meta::function_type type = meta::resolve_type(arg_unbounded_const_arr);
|
||||
REQUIRE(type);
|
||||
|
||||
CHECK(type.get_id() == meta::resolve_type(&arg_unbounded_const_arr).get_id());
|
||||
CHECK(type.get_id() == meta::resolve_type(arg_unbounded_const_arr).get_id());
|
||||
CHECK(type.get_flags() == meta::function_flags{});
|
||||
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<const ivec2*>()});
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace meta_hpp
|
||||
|| std::is_same_v<T, uvalue>; //
|
||||
|
||||
template < typename T >
|
||||
concept non_uvalue_family = (!uvalue_family<T>);
|
||||
concept non_uvalue_family = !uvalue_family<T>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,16 +129,28 @@ namespace meta_hpp::detail
|
||||
|
||||
#ifdef __COUNTER__
|
||||
# define META_HPP_DEFER(...) \
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_defer_, __COUNTER__) { ::meta_hpp::detail::make_defer(__VA_ARGS__) }
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_defer_, __COUNTER__) { \
|
||||
::meta_hpp::detail::make_defer(__VA_ARGS__) \
|
||||
}
|
||||
# define META_HPP_ERROR_DEFER(...) \
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_error_defer_, __COUNTER__) { ::meta_hpp::detail::make_error_defer(__VA_ARGS__) }
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_error_defer_, __COUNTER__) { \
|
||||
::meta_hpp::detail::make_error_defer(__VA_ARGS__) \
|
||||
}
|
||||
# define META_HPP_RETURN_DEFER(...) \
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_return_defer_, __COUNTER__) { ::meta_hpp::detail::make_return_defer(__VA_ARGS__) }
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_return_defer_, __COUNTER__) { \
|
||||
::meta_hpp::detail::make_return_defer(__VA_ARGS__) \
|
||||
}
|
||||
#else
|
||||
# define META_HPP_DEFER(...) \
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_defer_, __LINE__) { ::meta_hpp::detail::make_defer(__VA_ARGS__) }
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_defer_, __LINE__) { \
|
||||
::meta_hpp::detail::make_defer(__VA_ARGS__) \
|
||||
}
|
||||
# define META_HPP_ERROR_DEFER(...) \
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_error_defer_, __LINE__) { ::meta_hpp::detail::make_error_defer(__VA_ARGS__) }
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_error_defer_, __LINE__) { \
|
||||
::meta_hpp::detail::make_error_defer(__VA_ARGS__) \
|
||||
}
|
||||
# define META_HPP_RETURN_DEFER(...) \
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_return_defer_, __LINE__) { ::meta_hpp::detail::make_return_defer(__VA_ARGS__) }
|
||||
auto META_HPP_PP_CAT(meta_hpp_generated_return_defer_, __LINE__) { \
|
||||
::meta_hpp::detail::make_return_defer(__VA_ARGS__) \
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -104,10 +104,14 @@ namespace meta_hpp::detail
|
||||
{
|
||||
template < typename R, typename... Args >
|
||||
struct fixed_function<R(Args...)>::vtable_t final {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
|
||||
R (*const call)(const fixed_function& self, Args... args);
|
||||
void (*const move)(fixed_function& from, fixed_function& to) noexcept;
|
||||
void (*const destroy)(fixed_function& self);
|
||||
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < typename T >
|
||||
static T* buffer_cast(buffer_t& buffer) noexcept {
|
||||
// NOLINTNEXTLINE(*-reinterpret-cast)
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace meta_hpp::detail
|
||||
concept enum_kind = std::is_enum_v<T>;
|
||||
|
||||
template < typename T >
|
||||
concept function_pointer_kind = (std::is_pointer_v<T> && std::is_function_v<std::remove_pointer_t<T>>);
|
||||
concept function_kind = std::is_function_v<T>;
|
||||
|
||||
template < typename T >
|
||||
concept member_pointer_kind = std::is_member_object_pointer_v<T>;
|
||||
@@ -35,7 +35,7 @@ namespace meta_hpp::detail
|
||||
concept number_kind = std::is_arithmetic_v<T>;
|
||||
|
||||
template < typename T >
|
||||
concept pointer_kind = (std::is_pointer_v<T> && !std::is_function_v<std::remove_pointer_t<T>>);
|
||||
concept pointer_kind = std::is_pointer_v<T>;
|
||||
|
||||
template < typename T >
|
||||
concept reference_kind = std::is_reference_v<T>;
|
||||
@@ -47,7 +47,13 @@ namespace meta_hpp::detail
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < typename T >
|
||||
concept non_pointer_kind = (!pointer_kind<T>);
|
||||
concept non_pointer_kind = !std::is_pointer_v<T>;
|
||||
|
||||
template < typename T >
|
||||
concept function_pointer_kind = std::is_pointer_v<T> && std::is_function_v<std::remove_pointer_t<T>>;
|
||||
|
||||
template < typename T >
|
||||
concept non_function_pointer_kind = std::is_pointer_v<T> && !std::is_function_v<std::remove_pointer_t<T>>;
|
||||
}
|
||||
|
||||
namespace meta_hpp::detail
|
||||
@@ -74,7 +80,7 @@ namespace meta_hpp::detail
|
||||
if constexpr ( array_kind<T> ) { return type_kind::array_; }
|
||||
if constexpr ( class_kind<T> ) { return type_kind::class_; }
|
||||
if constexpr ( enum_kind<T> ) { return type_kind::enum_; }
|
||||
if constexpr ( function_pointer_kind<T> ) { return type_kind::function_; }
|
||||
if constexpr ( function_kind<T> ) { return type_kind::function_; }
|
||||
if constexpr ( member_pointer_kind<T> ) { return type_kind::member_; }
|
||||
if constexpr ( method_pointer_kind<T> ) { return type_kind::method_; }
|
||||
if constexpr ( nullptr_kind<T> ) { return type_kind::nullptr_; }
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace meta_hpp
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < detail::function_pointer_kind Function >
|
||||
template < detail::function_kind Function >
|
||||
class function_bind final : public type_bind_base<function_type> {
|
||||
public:
|
||||
explicit function_bind(metadata_map metadata);
|
||||
@@ -354,7 +354,7 @@ namespace meta_hpp
|
||||
return enum_bind<Enum>{std::move(metadata)};
|
||||
}
|
||||
|
||||
template < detail::function_pointer_kind Function >
|
||||
template < detail::function_kind Function >
|
||||
function_bind<Function> function_(metadata_map metadata = {}) {
|
||||
return function_bind<Function>{std::move(metadata)};
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace meta_hpp
|
||||
{
|
||||
template < detail::function_pointer_kind Function >
|
||||
template < detail::function_kind Function >
|
||||
function_bind<Function>::function_bind(metadata_map metadata)
|
||||
: type_bind_base{resolve_type<Function>(), std::move(metadata)} {}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace meta_hpp::detail
|
||||
if constexpr ( array_kind<T> ) { return resolve_array_type<T>(); }
|
||||
if constexpr ( class_kind<T> ) { return resolve_class_type<T>(); }
|
||||
if constexpr ( enum_kind<T> ) { return resolve_enum_type<T>(); }
|
||||
if constexpr ( function_pointer_kind<T> ) { return resolve_function_type<T>(); }
|
||||
if constexpr ( function_kind<T> ) { return resolve_function_type<T>(); }
|
||||
if constexpr ( member_pointer_kind<T> ) { return resolve_member_type<T>(); }
|
||||
if constexpr ( method_pointer_kind<T> ) { return resolve_method_type<T>(); }
|
||||
if constexpr ( nullptr_kind<T> ) { return resolve_nullptr_type<T>(); }
|
||||
@@ -99,7 +99,7 @@ namespace meta_hpp::detail
|
||||
return type;
|
||||
}
|
||||
|
||||
template < function_pointer_kind Function >
|
||||
template < function_kind Function >
|
||||
[[nodiscard]] function_type resolve_function_type() {
|
||||
using function_t = std::remove_cv_t<Function>;
|
||||
static function_type type{ensure_type<function_type_data>(type_list<function_t>{})};
|
||||
|
||||
@@ -20,11 +20,11 @@ namespace meta_hpp::detail
|
||||
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < function_pointer_kind Function >
|
||||
template < function_kind Function >
|
||||
struct function_traits;
|
||||
|
||||
template < typename R, typename... Args >
|
||||
struct function_traits<R (*)(Args...)> {
|
||||
struct function_traits<R(Args...)> {
|
||||
static constexpr std::size_t arity{sizeof...(Args)};
|
||||
|
||||
using return_type = R;
|
||||
@@ -36,7 +36,7 @@ namespace meta_hpp::detail
|
||||
};
|
||||
|
||||
template < typename R, typename... Args >
|
||||
struct function_traits<R (*)(Args...) noexcept> : function_traits<R (*)(Args...)> {
|
||||
struct function_traits<R(Args...) noexcept> : function_traits<R(Args...)> {
|
||||
[[nodiscard]] static constexpr function_bitflags make_flags() noexcept {
|
||||
return function_flags::is_noexcept;
|
||||
}
|
||||
|
||||
@@ -82,10 +82,11 @@ namespace meta_hpp::detail
|
||||
return raw_type_;
|
||||
}
|
||||
|
||||
template < pointer_kind To >
|
||||
template < non_function_pointer_kind To >
|
||||
[[nodiscard]] bool can_cast_to(type_registry& registry) const noexcept;
|
||||
|
||||
template < non_pointer_kind To >
|
||||
template < typename To >
|
||||
requires(!non_function_pointer_kind<To>)
|
||||
[[nodiscard]] bool can_cast_to(type_registry& registry) const noexcept;
|
||||
|
||||
private:
|
||||
@@ -124,10 +125,11 @@ namespace meta_hpp::detail
|
||||
: uarg_base{registry, std::forward<T>(v)}
|
||||
, data_{const_cast<std::remove_cvref_t<T>*>(std::addressof(v))} {} // NOLINT(*-const-cast)
|
||||
|
||||
template < pointer_kind To >
|
||||
template < non_function_pointer_kind To >
|
||||
[[nodiscard]] decltype(auto) cast(type_registry& registry) const;
|
||||
|
||||
template < non_pointer_kind To >
|
||||
template < typename To >
|
||||
requires(!non_function_pointer_kind<To>)
|
||||
[[nodiscard]] decltype(auto) cast(type_registry& registry) const;
|
||||
|
||||
private:
|
||||
@@ -137,7 +139,7 @@ namespace meta_hpp::detail
|
||||
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < pointer_kind To >
|
||||
template < non_function_pointer_kind To >
|
||||
[[nodiscard]] bool uarg_base::can_cast_to(type_registry& registry) const noexcept {
|
||||
using to_raw_type = std::remove_cv_t<To>;
|
||||
|
||||
@@ -183,7 +185,8 @@ namespace meta_hpp::detail
|
||||
return false;
|
||||
}
|
||||
|
||||
template < non_pointer_kind To >
|
||||
template < typename To >
|
||||
requires(!non_function_pointer_kind<To>)
|
||||
[[nodiscard]] bool uarg_base::can_cast_to(type_registry& registry) const noexcept {
|
||||
using to_raw_type_cv = std::remove_reference_t<To>;
|
||||
using to_raw_type = std::remove_cv_t<to_raw_type_cv>;
|
||||
@@ -230,7 +233,7 @@ namespace meta_hpp::detail
|
||||
}
|
||||
}
|
||||
|
||||
if constexpr ( non_pointer_kind<To> && !std::is_reference_v<To> ) {
|
||||
if constexpr ( !std::is_reference_v<To> ) {
|
||||
if ( is_a(to_type, from_type) && is_constructible_from_type(type_list<to_raw_type>{}) ) {
|
||||
return true;
|
||||
}
|
||||
@@ -242,7 +245,7 @@ namespace meta_hpp::detail
|
||||
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < pointer_kind To >
|
||||
template < non_function_pointer_kind To >
|
||||
[[nodiscard]] decltype(auto) uarg::cast(type_registry& registry) const {
|
||||
META_HPP_DEV_ASSERT(can_cast_to<To>(registry) && "bad argument cast");
|
||||
|
||||
@@ -284,7 +287,8 @@ namespace meta_hpp::detail
|
||||
throw_exception(error_code::bad_argument_cast);
|
||||
}
|
||||
|
||||
template < non_pointer_kind To >
|
||||
template < typename To >
|
||||
requires(!non_function_pointer_kind<To>)
|
||||
[[nodiscard]] decltype(auto) uarg::cast(type_registry& registry) const {
|
||||
META_HPP_DEV_ASSERT(can_cast_to<To>(registry) && "bad argument cast");
|
||||
|
||||
@@ -345,10 +349,9 @@ namespace meta_hpp::detail
|
||||
if ( args.size() != type_list_arity_v<ArgTypeList> ) {
|
||||
return false;
|
||||
}
|
||||
return [ args, ®istry ]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
return [args, ®istry]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
return (... && args[Is].can_cast_to<type_list_at_t<Is, ArgTypeList>>(registry));
|
||||
}
|
||||
(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
|
||||
}(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
|
||||
}
|
||||
|
||||
template < typename ArgTypeList >
|
||||
@@ -356,18 +359,16 @@ namespace meta_hpp::detail
|
||||
if ( args.size() != type_list_arity_v<ArgTypeList> ) {
|
||||
return false;
|
||||
}
|
||||
return [ args, ®istry ]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
return [args, ®istry]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
return (... && args[Is].can_cast_to<type_list_at_t<Is, ArgTypeList>>(registry));
|
||||
}
|
||||
(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
|
||||
}(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
|
||||
}
|
||||
|
||||
template < typename ArgTypeList, typename F >
|
||||
auto unchecked_call_with_uargs(type_registry& registry, std::span<const uarg> args, F&& f) {
|
||||
META_HPP_DEV_ASSERT(args.size() == type_list_arity_v<ArgTypeList>);
|
||||
return [ args, ®istry, &f ]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
return [args, ®istry, &f]<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
return f(args[Is].cast<type_list_at_t<Is, ArgTypeList>>(registry)...);
|
||||
}
|
||||
(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
|
||||
}(std::make_index_sequence<type_list_arity_v<ArgTypeList>>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@ namespace meta_hpp::detail
|
||||
template < typename T, typename Tp = std::decay_t<T> >
|
||||
concept arg_lvalue_ref_kind //
|
||||
= (non_uvalue_family<Tp>) //
|
||||
&& (std::is_lvalue_reference_v<T>);
|
||||
&&(std::is_lvalue_reference_v<T>);
|
||||
|
||||
template < typename T, typename Tp = std::decay_t<T> >
|
||||
concept arg_rvalue_ref_kind //
|
||||
= (non_uvalue_family<Tp>) //
|
||||
&& (!std::is_reference_v<T> || std::is_rvalue_reference_v<T>);
|
||||
&&(!std::is_reference_v<T> || std::is_rvalue_reference_v<T>);
|
||||
}
|
||||
|
||||
namespace meta_hpp::detail
|
||||
@@ -32,14 +32,14 @@ namespace meta_hpp::detail
|
||||
template < typename T, typename Tp = std::decay_t<T> >
|
||||
concept inst_class_lvalue_ref_kind //
|
||||
= (non_uvalue_family<Tp>) //
|
||||
&& (std::is_lvalue_reference_v<T>) //
|
||||
&& (std::is_class_v<std::remove_pointer_t<std::remove_reference_t<T>>>);
|
||||
&&(std::is_lvalue_reference_v<T>) //
|
||||
&&(std::is_class_v<std::remove_pointer_t<std::remove_reference_t<T>>>);
|
||||
|
||||
template < typename T, typename Tp = std::decay_t<T> >
|
||||
concept inst_class_rvalue_ref_kind //
|
||||
= (non_uvalue_family<Tp>) //
|
||||
&& (!std::is_reference_v<T> || std::is_rvalue_reference_v<T>) //
|
||||
&& (std::is_class_v<std::remove_pointer_t<std::remove_reference_t<T>>>);
|
||||
&&(!std::is_reference_v<T> || std::is_rvalue_reference_v<T>) //
|
||||
&&(std::is_class_v<std::remove_pointer_t<std::remove_reference_t<T>>>);
|
||||
}
|
||||
|
||||
namespace meta_hpp::detail
|
||||
|
||||
@@ -20,7 +20,12 @@ namespace meta_hpp::detail
|
||||
template < typename Argument >
|
||||
inline argument_state_ptr argument_state::make(std::size_t position, metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
argument_state state{argument_index{registry.resolve_type<Argument>(), position}, std::move(metadata)};
|
||||
|
||||
argument_state state{
|
||||
argument_index{registry.resolve_type<Argument>(), position},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
return make_intrusive<argument_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,8 +130,7 @@ namespace meta_hpp::detail
|
||||
return argument{argument_state::make<P>(I, metadata_map{})};
|
||||
};
|
||||
return argument_list{make_argument(index_constant<Is>{})...};
|
||||
}
|
||||
(std::make_index_sequence<ct::arity>());
|
||||
}(std::make_index_sequence<ct::arity>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,11 +143,17 @@ namespace meta_hpp::detail
|
||||
template < constructor_policy_family Policy, class_kind Class, typename... Args >
|
||||
constructor_state_ptr constructor_state::make(metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
constructor_state state{constructor_index{registry.resolve_constructor_type<Class, Args...>()}, std::move(metadata)};
|
||||
|
||||
constructor_state state{
|
||||
constructor_index{registry.resolve_constructor_type<Class, Args...>()},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.create = make_constructor_create<Policy, Class, Args...>(registry);
|
||||
state.create_at = make_constructor_create_at<Class, Args...>(registry);
|
||||
state.create_error = make_constructor_create_error<Class, Args...>(registry);
|
||||
state.arguments = make_constructor_arguments<Class, Args...>();
|
||||
|
||||
return make_intrusive<constructor_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,10 +80,16 @@ namespace meta_hpp::detail
|
||||
template < class_kind Class >
|
||||
destructor_state_ptr destructor_state::make(metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
destructor_state state{destructor_index{registry.resolve_destructor_type<Class>()}, std::move(metadata)};
|
||||
|
||||
destructor_state state{
|
||||
destructor_index{registry.resolve_destructor_type<Class>()},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.destroy = make_destructor_destroy<Class>(registry);
|
||||
state.destroy_at = make_destructor_destroy_at<Class>();
|
||||
state.destroy_error = make_destructor_destroy_error<Class>(registry);
|
||||
|
||||
return make_intrusive<destructor_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,15 @@ namespace meta_hpp::detail
|
||||
template < enum_kind Enum >
|
||||
evalue_state_ptr evalue_state::make(std::string name, Enum evalue, metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
evalue_state state{evalue_index{registry.resolve_type<Enum>(), std::move(name)}, std::move(metadata)};
|
||||
|
||||
evalue_state state{
|
||||
evalue_index{registry.resolve_type<Enum>(), std::move(name)},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.enum_value = uvalue{evalue};
|
||||
state.underlying_value = uvalue{to_underlying(evalue)};
|
||||
|
||||
return make_intrusive<evalue_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace meta_hpp::detail
|
||||
{
|
||||
template < function_policy_family Policy, function_pointer_kind Function >
|
||||
uvalue raw_function_invoke(type_registry& registry, Function function_ptr, std::span<const uarg> args) {
|
||||
using ft = function_traits<Function>;
|
||||
using ft = function_traits<std::remove_pointer_t<Function>>;
|
||||
using return_type = typename ft::return_type;
|
||||
using argument_types = typename ft::argument_types;
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace meta_hpp::detail
|
||||
|
||||
template < function_pointer_kind Function >
|
||||
uerror raw_function_invoke_error(type_registry& registry, std::span<const uarg_base> args) noexcept {
|
||||
using ft = function_traits<Function>;
|
||||
using ft = function_traits<std::remove_pointer_t<Function>>;
|
||||
using argument_types = typename ft::argument_types;
|
||||
|
||||
if ( args.size() != ft::arity ) {
|
||||
@@ -98,7 +98,7 @@ namespace meta_hpp::detail
|
||||
|
||||
template < function_pointer_kind Function >
|
||||
argument_list make_function_arguments() {
|
||||
using ft = function_traits<Function>;
|
||||
using ft = function_traits<std::remove_pointer_t<Function>>;
|
||||
using ft_argument_types = typename ft::argument_types;
|
||||
|
||||
return []<std::size_t... Is>(std::index_sequence<Is...>) {
|
||||
@@ -107,8 +107,7 @@ namespace meta_hpp::detail
|
||||
return argument{argument_state::make<P>(I, metadata_map{})};
|
||||
};
|
||||
return argument_list{make_argument(index_constant<Is>{})...};
|
||||
}
|
||||
(std::make_index_sequence<ft::arity>());
|
||||
}(std::make_index_sequence<ft::arity>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,10 +120,16 @@ namespace meta_hpp::detail
|
||||
template < function_policy_family Policy, function_pointer_kind Function >
|
||||
function_state_ptr function_state::make(std::string name, Function function_ptr, metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
function_state state{function_index{registry.resolve_type<Function>(), std::move(name)}, std::move(metadata)};
|
||||
|
||||
function_state state{
|
||||
function_index{registry.resolve_type<std::remove_pointer_t<Function>>(), std::move(name)},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.invoke = make_function_invoke<Policy>(registry, function_ptr);
|
||||
state.invoke_error = make_function_invoke_error<Function>(registry);
|
||||
state.arguments = make_function_arguments<Function>();
|
||||
|
||||
return make_intrusive<function_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,11 +197,17 @@ namespace meta_hpp::detail
|
||||
template < member_policy_family Policy, member_pointer_kind Member >
|
||||
member_state_ptr member_state::make(std::string name, Member member_ptr, metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
member_state state{member_index{registry.resolve_type<Member>(), std::move(name)}, std::move(metadata)};
|
||||
|
||||
member_state state{
|
||||
member_index{registry.resolve_type<Member>(), std::move(name)},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.getter = make_member_getter<Policy>(registry, member_ptr);
|
||||
state.setter = make_member_setter(registry, member_ptr);
|
||||
state.getter_error = make_member_getter_error<Member>(registry);
|
||||
state.setter_error = make_member_setter_error<Member>(registry);
|
||||
|
||||
return make_intrusive<member_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,8 +119,7 @@ namespace meta_hpp::detail
|
||||
return argument{argument_state::make<P>(I, metadata_map{})};
|
||||
};
|
||||
return argument_list{make_argument(index_constant<Is>{})...};
|
||||
}
|
||||
(std::make_index_sequence<mt::arity>());
|
||||
}(std::make_index_sequence<mt::arity>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,10 +132,16 @@ namespace meta_hpp::detail
|
||||
template < method_policy_family Policy, method_pointer_kind Method >
|
||||
method_state_ptr method_state::make(std::string name, Method method_ptr, metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
method_state state{method_index{registry.resolve_type<Method>(), std::move(name)}, std::move(metadata)};
|
||||
|
||||
method_state state{
|
||||
method_index{registry.resolve_type<Method>(), std::move(name)},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.invoke = make_method_invoke<Policy>(registry, method_ptr);
|
||||
state.invoke_error = make_method_invoke_error<Method>(registry);
|
||||
state.arguments = make_method_arguments<Method>();
|
||||
|
||||
return make_intrusive<method_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,10 @@ namespace meta_hpp::detail
|
||||
, metadata{std::move(nmetadata)} {}
|
||||
|
||||
inline scope_state_ptr scope_state::make(std::string name, metadata_map metadata) {
|
||||
scope_state state{scope_index{std::move(name)}, std::move(metadata)};
|
||||
scope_state state{
|
||||
scope_index{std::move(name)},
|
||||
std::move(metadata),
|
||||
};
|
||||
return make_intrusive<scope_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,10 +118,16 @@ namespace meta_hpp::detail
|
||||
template < variable_policy_family Policy, pointer_kind Pointer >
|
||||
variable_state_ptr variable_state::make(std::string name, Pointer variable_ptr, metadata_map metadata) {
|
||||
type_registry& registry{type_registry::instance()};
|
||||
variable_state state{variable_index{registry.resolve_type<Pointer>(), std::move(name)}, std::move(metadata)};
|
||||
|
||||
variable_state state{
|
||||
variable_index{registry.resolve_type<Pointer>(), std::move(name)},
|
||||
std::move(metadata),
|
||||
};
|
||||
|
||||
state.getter = make_variable_getter<Policy>(registry, variable_ptr);
|
||||
state.setter = make_variable_setter(registry, variable_ptr);
|
||||
state.setter_error = make_variable_setter_error<Pointer>(registry);
|
||||
|
||||
return make_intrusive<variable_state>(std::move(state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,7 +462,9 @@ namespace meta_hpp
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
struct type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const type_kind kind;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
metadata_map metadata{};
|
||||
|
||||
@@ -479,19 +481,23 @@ namespace meta_hpp::detail
|
||||
};
|
||||
|
||||
struct array_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const array_bitflags flags;
|
||||
const std::size_t extent;
|
||||
const any_type data_type;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < array_kind Array >
|
||||
explicit array_type_data(type_list<Array>);
|
||||
};
|
||||
|
||||
struct class_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const class_bitflags flags;
|
||||
const std::size_t size;
|
||||
const std::size_t align;
|
||||
const any_type_list argument_types;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
class_list base_classes;
|
||||
class_list derived_classes;
|
||||
@@ -546,25 +552,31 @@ namespace meta_hpp::detail
|
||||
};
|
||||
|
||||
struct constructor_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const constructor_bitflags flags;
|
||||
const class_type owner_type;
|
||||
const any_type_list argument_types;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < class_kind Class, typename... Args >
|
||||
explicit constructor_type_data(type_list<Class>, type_list<Args...>);
|
||||
};
|
||||
|
||||
struct destructor_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const destructor_bitflags flags;
|
||||
const class_type owner_type;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < class_kind Class >
|
||||
explicit destructor_type_data(type_list<Class>);
|
||||
};
|
||||
|
||||
struct enum_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const enum_bitflags flags;
|
||||
const number_type underlying_type;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
evalue_list evalues;
|
||||
|
||||
@@ -573,28 +585,34 @@ namespace meta_hpp::detail
|
||||
};
|
||||
|
||||
struct function_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const function_bitflags flags;
|
||||
const any_type return_type;
|
||||
const any_type_list argument_types;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < function_pointer_kind Function >
|
||||
template < function_kind Function >
|
||||
explicit function_type_data(type_list<Function>);
|
||||
};
|
||||
|
||||
struct member_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const member_bitflags flags;
|
||||
const class_type owner_type;
|
||||
const any_type value_type;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < member_pointer_kind Member >
|
||||
explicit member_type_data(type_list<Member>);
|
||||
};
|
||||
|
||||
struct method_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const method_bitflags flags;
|
||||
const class_type owner_type;
|
||||
const any_type return_type;
|
||||
const any_type_list argument_types;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < method_pointer_kind Method >
|
||||
explicit method_type_data(type_list<Method>);
|
||||
@@ -606,25 +624,31 @@ namespace meta_hpp::detail
|
||||
};
|
||||
|
||||
struct number_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const number_bitflags flags;
|
||||
const std::size_t size;
|
||||
const std::size_t align;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < number_kind Number >
|
||||
explicit number_type_data(type_list<Number>);
|
||||
};
|
||||
|
||||
struct pointer_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const pointer_bitflags flags;
|
||||
const any_type data_type;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < pointer_kind Pointer >
|
||||
explicit pointer_type_data(type_list<Pointer>);
|
||||
};
|
||||
|
||||
struct reference_type_data final : type_data_base {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const reference_bitflags flags;
|
||||
const any_type data_type;
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < reference_kind Reference >
|
||||
explicit reference_type_data(type_list<Reference>);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace meta_hpp::detail
|
||||
{
|
||||
template < function_pointer_kind Function >
|
||||
template < function_kind Function >
|
||||
function_type_data::function_type_data(type_list<Function>)
|
||||
: type_data_base{type_kind::function_}
|
||||
, flags{function_traits<Function>::make_flags()}
|
||||
|
||||
@@ -15,11 +15,11 @@ namespace meta_hpp::detail
|
||||
typename From,
|
||||
typename ToDT = std::remove_pointer_t<To>,
|
||||
typename FromDT = std::remove_pointer_t<From> >
|
||||
concept pointer_ucast_kind //
|
||||
= (std::is_pointer_v<From> && std::is_class_v<FromDT>) //
|
||||
&& (std::is_pointer_v<To> && (std::is_class_v<ToDT> || std::is_void_v<ToDT>)) //
|
||||
&& (!std::is_const_v<FromDT> || std::is_const_v<ToDT>) //
|
||||
&& (!std::is_volatile_v<FromDT> || std::is_volatile_v<ToDT>); //
|
||||
concept pointer_ucast_kind //
|
||||
= (std::is_pointer_v<From> && std::is_class_v<FromDT>) //
|
||||
&&(std::is_pointer_v<To> && (std::is_class_v<ToDT> || std::is_void_v<ToDT>)) //
|
||||
&& (!std::is_const_v<FromDT> || std::is_const_v<ToDT>) //
|
||||
&&(!std::is_volatile_v<FromDT> || std::is_volatile_v<ToDT>); //
|
||||
|
||||
template <
|
||||
typename To,
|
||||
@@ -28,9 +28,9 @@ namespace meta_hpp::detail
|
||||
typename FromDT = std::remove_reference_t<From> >
|
||||
concept lvalue_reference_ucast_kind //
|
||||
= (std::is_lvalue_reference_v<From> && std::is_class_v<FromDT>) //
|
||||
&& (std::is_lvalue_reference_v<To> && std::is_class_v<ToDT>) //
|
||||
&& (!std::is_const_v<FromDT> || std::is_const_v<ToDT>) //
|
||||
&& (!std::is_volatile_v<FromDT> || std::is_volatile_v<ToDT>); //
|
||||
&&(std::is_lvalue_reference_v<To> && std::is_class_v<ToDT>) //
|
||||
&&(!std::is_const_v<FromDT> || std::is_const_v<ToDT>) //
|
||||
&&(!std::is_volatile_v<FromDT> || std::is_volatile_v<ToDT>); //
|
||||
}
|
||||
|
||||
namespace meta_hpp
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
namespace meta_hpp
|
||||
{
|
||||
struct uvalue::vtable_t final {
|
||||
// NOLINTBEGIN(*-avoid-const-or-ref-data-members)
|
||||
const any_type type;
|
||||
|
||||
void (*const move)(uvalue&& self, uvalue& to) noexcept;
|
||||
@@ -29,6 +30,7 @@ namespace meta_hpp
|
||||
uvalue (*const deref)(const storage_u& self);
|
||||
uvalue (*const index)(const storage_u& self, std::size_t i);
|
||||
uvalue (*const unmap)(const storage_u& self);
|
||||
// NOLINTEND(*-avoid-const-or-ref-data-members)
|
||||
|
||||
template < typename T >
|
||||
inline static constexpr bool in_internal_v = //
|
||||
|
||||
Reference in New Issue
Block a user