mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-16 22:17:02 +07:00
some new typedefs
This commit is contained in:
@@ -188,7 +188,9 @@ namespace meta_hpp
|
|||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
|
using any_type_list = std::vector<any_type>;
|
||||||
using argument_list = std::vector<argument>;
|
using argument_list = std::vector<argument>;
|
||||||
|
|
||||||
using metadata_map = std::map<std::string, uvalue, std::less<>>;
|
using metadata_map = std::map<std::string, uvalue, std::less<>>;
|
||||||
using typedef_map = std::map<std::string, any_type, std::less<>>;
|
using typedef_map = std::map<std::string, any_type, std::less<>>;
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,10 @@ namespace meta_hpp
|
|||||||
metadata_map metadata{};
|
metadata_map metadata{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using argument_opts_list = std::vector<argument_opts>;
|
||||||
|
|
||||||
struct constructor_opts final {
|
struct constructor_opts final {
|
||||||
std::vector<argument_opts> arguments{};
|
argument_opts_list arguments{};
|
||||||
metadata_map metadata{};
|
metadata_map metadata{};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -61,7 +63,7 @@ namespace meta_hpp
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct function_opts final {
|
struct function_opts final {
|
||||||
std::vector<argument_opts> arguments{};
|
argument_opts_list arguments{};
|
||||||
metadata_map metadata{};
|
metadata_map metadata{};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -70,7 +72,7 @@ namespace meta_hpp
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct method_opts final {
|
struct method_opts final {
|
||||||
std::vector<argument_opts> arguments{};
|
argument_opts_list arguments{};
|
||||||
metadata_map metadata{};
|
metadata_map metadata{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
|
|
||||||
template < typename... Ts >
|
template < typename... Ts >
|
||||||
[[nodiscard]] std::vector<any_type> resolve_types() {
|
[[nodiscard]] any_type_list resolve_types() {
|
||||||
return { resolve_type<Ts>()... };
|
return { resolve_type<Ts>()... };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
|
|
||||||
template < typename... Ts >
|
template < typename... Ts >
|
||||||
[[nodiscard]] std::vector<any_type> resolve_types(type_list<Ts...>) {
|
[[nodiscard]] any_type_list resolve_types(type_list<Ts...>) {
|
||||||
return { resolve_type<Ts>()... };
|
return { resolve_type<Ts>()... };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ namespace meta_hpp
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<any_type>& args = function.get_type().get_argument_types();
|
const any_type_list& args = function.get_type().get_argument_types();
|
||||||
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
||||||
return function;
|
return function;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
[[nodiscard]] std::size_t get_arity() const noexcept;
|
[[nodiscard]] std::size_t get_arity() const noexcept;
|
||||||
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
||||||
[[nodiscard]] const std::vector<any_type>& get_argument_types() const noexcept;
|
[[nodiscard]] const any_type_list& get_argument_types() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] const class_set& get_bases() const noexcept;
|
[[nodiscard]] const class_set& get_bases() const noexcept;
|
||||||
[[nodiscard]] const constructor_map& get_constructors() const noexcept;
|
[[nodiscard]] const constructor_map& get_constructors() const noexcept;
|
||||||
@@ -228,7 +228,7 @@ namespace meta_hpp
|
|||||||
[[nodiscard]] std::size_t get_arity() const noexcept;
|
[[nodiscard]] std::size_t get_arity() const noexcept;
|
||||||
[[nodiscard]] any_type get_class_type() const noexcept;
|
[[nodiscard]] any_type get_class_type() const noexcept;
|
||||||
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
||||||
[[nodiscard]] const std::vector<any_type>& get_argument_types() const noexcept;
|
[[nodiscard]] const any_type_list& get_argument_types() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::constructor_type_data* data_{};
|
detail::constructor_type_data* data_{};
|
||||||
friend auto detail::type_access<constructor_type>(const constructor_type&);
|
friend auto detail::type_access<constructor_type>(const constructor_type&);
|
||||||
@@ -293,7 +293,7 @@ namespace meta_hpp
|
|||||||
[[nodiscard]] std::size_t get_arity() const noexcept;
|
[[nodiscard]] std::size_t get_arity() const noexcept;
|
||||||
[[nodiscard]] any_type get_return_type() const noexcept;
|
[[nodiscard]] any_type get_return_type() const noexcept;
|
||||||
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
||||||
[[nodiscard]] const std::vector<any_type>& get_argument_types() const noexcept;
|
[[nodiscard]] const any_type_list& get_argument_types() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::function_type_data* data_{};
|
detail::function_type_data* data_{};
|
||||||
friend auto detail::type_access<function_type>(const function_type&);
|
friend auto detail::type_access<function_type>(const function_type&);
|
||||||
@@ -334,7 +334,7 @@ namespace meta_hpp
|
|||||||
[[nodiscard]] class_type get_owner_type() const noexcept;
|
[[nodiscard]] class_type get_owner_type() const noexcept;
|
||||||
[[nodiscard]] any_type get_return_type() const noexcept;
|
[[nodiscard]] any_type get_return_type() const noexcept;
|
||||||
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
||||||
[[nodiscard]] const std::vector<any_type>& get_argument_types() const noexcept;
|
[[nodiscard]] const any_type_list& get_argument_types() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::method_type_data* data_{};
|
detail::method_type_data* data_{};
|
||||||
friend auto detail::type_access<method_type>(const method_type&);
|
friend auto detail::type_access<method_type>(const method_type&);
|
||||||
@@ -496,7 +496,7 @@ namespace meta_hpp::detail
|
|||||||
const class_bitflags flags;
|
const class_bitflags flags;
|
||||||
const std::size_t size;
|
const std::size_t size;
|
||||||
const std::size_t align;
|
const std::size_t align;
|
||||||
const std::vector<any_type> argument_types;
|
const any_type_list argument_types;
|
||||||
|
|
||||||
class_set bases;
|
class_set bases;
|
||||||
constructor_map constructors;
|
constructor_map constructors;
|
||||||
@@ -522,7 +522,7 @@ namespace meta_hpp::detail
|
|||||||
struct constructor_type_data final : type_data_base {
|
struct constructor_type_data final : type_data_base {
|
||||||
const constructor_bitflags flags;
|
const constructor_bitflags flags;
|
||||||
const any_type class_type;
|
const any_type class_type;
|
||||||
const std::vector<any_type> argument_types;
|
const any_type_list argument_types;
|
||||||
|
|
||||||
template < class_kind Class, typename... Args >
|
template < class_kind Class, typename... Args >
|
||||||
explicit constructor_type_data(type_list<Class>, type_list<Args...>);
|
explicit constructor_type_data(type_list<Class>, type_list<Args...>);
|
||||||
@@ -549,7 +549,7 @@ namespace meta_hpp::detail
|
|||||||
struct function_type_data final : type_data_base {
|
struct function_type_data final : type_data_base {
|
||||||
const function_bitflags flags;
|
const function_bitflags flags;
|
||||||
const any_type return_type;
|
const any_type return_type;
|
||||||
const std::vector<any_type> argument_types;
|
const any_type_list argument_types;
|
||||||
|
|
||||||
template < function_kind Function >
|
template < function_kind Function >
|
||||||
explicit function_type_data(type_list<Function>);
|
explicit function_type_data(type_list<Function>);
|
||||||
@@ -568,7 +568,7 @@ namespace meta_hpp::detail
|
|||||||
const method_bitflags flags;
|
const method_bitflags flags;
|
||||||
const class_type owner_type;
|
const class_type owner_type;
|
||||||
const any_type return_type;
|
const any_type return_type;
|
||||||
const std::vector<any_type> argument_types;
|
const any_type_list argument_types;
|
||||||
|
|
||||||
template < method_kind Method >
|
template < method_kind Method >
|
||||||
explicit method_type_data(type_list<Method>);
|
explicit method_type_data(type_list<Method>);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace meta_hpp
|
|||||||
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const std::vector<any_type>& class_type::get_argument_types() const noexcept {
|
inline const any_type_list& class_type::get_argument_types() const noexcept {
|
||||||
return data_->argument_types;
|
return data_->argument_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ namespace meta_hpp
|
|||||||
template < typename Iter >
|
template < typename Iter >
|
||||||
constructor class_type::get_constructor_with(Iter first, Iter last) const noexcept {
|
constructor class_type::get_constructor_with(Iter first, Iter last) const noexcept {
|
||||||
for ( auto&& [index, ctor] : data_->constructors ) {
|
for ( auto&& [index, ctor] : data_->constructors ) {
|
||||||
const std::vector<any_type>& args = ctor.get_type().get_argument_types();
|
const any_type_list& args = ctor.get_type().get_argument_types();
|
||||||
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
||||||
return ctor;
|
return ctor;
|
||||||
}
|
}
|
||||||
@@ -307,7 +307,7 @@ namespace meta_hpp
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<any_type>& args = function.get_type().get_argument_types();
|
const any_type_list& args = function.get_type().get_argument_types();
|
||||||
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
||||||
return function;
|
return function;
|
||||||
}
|
}
|
||||||
@@ -346,7 +346,7 @@ namespace meta_hpp
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<any_type>& args = method.get_type().get_argument_types();
|
const any_type_list& args = method.get_type().get_argument_types();
|
||||||
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace meta_hpp
|
|||||||
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const std::vector<any_type>& constructor_type::get_argument_types() const noexcept {
|
inline const any_type_list& constructor_type::get_argument_types() const noexcept {
|
||||||
return data_->argument_types;
|
return data_->argument_types;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace meta_hpp
|
|||||||
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const std::vector<any_type>& function_type::get_argument_types() const noexcept {
|
inline const any_type_list& function_type::get_argument_types() const noexcept {
|
||||||
return data_->argument_types;
|
return data_->argument_types;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace meta_hpp
|
|||||||
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const std::vector<any_type>& method_type::get_argument_types() const noexcept {
|
inline const any_type_list& method_type::get_argument_types() const noexcept {
|
||||||
return data_->argument_types;
|
return data_->argument_types;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -881,7 +881,9 @@ namespace meta_hpp
|
|||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
|
using any_type_list = std::vector<any_type>;
|
||||||
using argument_list = std::vector<argument>;
|
using argument_list = std::vector<argument>;
|
||||||
|
|
||||||
using metadata_map = std::map<std::string, uvalue, std::less<>>;
|
using metadata_map = std::map<std::string, uvalue, std::less<>>;
|
||||||
using typedef_map = std::map<std::string, any_type, std::less<>>;
|
using typedef_map = std::map<std::string, any_type, std::less<>>;
|
||||||
|
|
||||||
@@ -1562,7 +1564,7 @@ namespace meta_hpp
|
|||||||
|
|
||||||
[[nodiscard]] std::size_t get_arity() const noexcept;
|
[[nodiscard]] std::size_t get_arity() const noexcept;
|
||||||
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
||||||
[[nodiscard]] const std::vector<any_type>& get_argument_types() const noexcept;
|
[[nodiscard]] const any_type_list& get_argument_types() const noexcept;
|
||||||
|
|
||||||
[[nodiscard]] const class_set& get_bases() const noexcept;
|
[[nodiscard]] const class_set& get_bases() const noexcept;
|
||||||
[[nodiscard]] const constructor_map& get_constructors() const noexcept;
|
[[nodiscard]] const constructor_map& get_constructors() const noexcept;
|
||||||
@@ -1636,7 +1638,7 @@ namespace meta_hpp
|
|||||||
[[nodiscard]] std::size_t get_arity() const noexcept;
|
[[nodiscard]] std::size_t get_arity() const noexcept;
|
||||||
[[nodiscard]] any_type get_class_type() const noexcept;
|
[[nodiscard]] any_type get_class_type() const noexcept;
|
||||||
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
||||||
[[nodiscard]] const std::vector<any_type>& get_argument_types() const noexcept;
|
[[nodiscard]] const any_type_list& get_argument_types() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::constructor_type_data* data_{};
|
detail::constructor_type_data* data_{};
|
||||||
friend auto detail::type_access<constructor_type>(const constructor_type&);
|
friend auto detail::type_access<constructor_type>(const constructor_type&);
|
||||||
@@ -1701,7 +1703,7 @@ namespace meta_hpp
|
|||||||
[[nodiscard]] std::size_t get_arity() const noexcept;
|
[[nodiscard]] std::size_t get_arity() const noexcept;
|
||||||
[[nodiscard]] any_type get_return_type() const noexcept;
|
[[nodiscard]] any_type get_return_type() const noexcept;
|
||||||
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
||||||
[[nodiscard]] const std::vector<any_type>& get_argument_types() const noexcept;
|
[[nodiscard]] const any_type_list& get_argument_types() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::function_type_data* data_{};
|
detail::function_type_data* data_{};
|
||||||
friend auto detail::type_access<function_type>(const function_type&);
|
friend auto detail::type_access<function_type>(const function_type&);
|
||||||
@@ -1742,7 +1744,7 @@ namespace meta_hpp
|
|||||||
[[nodiscard]] class_type get_owner_type() const noexcept;
|
[[nodiscard]] class_type get_owner_type() const noexcept;
|
||||||
[[nodiscard]] any_type get_return_type() const noexcept;
|
[[nodiscard]] any_type get_return_type() const noexcept;
|
||||||
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
[[nodiscard]] any_type get_argument_type(std::size_t position) const noexcept;
|
||||||
[[nodiscard]] const std::vector<any_type>& get_argument_types() const noexcept;
|
[[nodiscard]] const any_type_list& get_argument_types() const noexcept;
|
||||||
private:
|
private:
|
||||||
detail::method_type_data* data_{};
|
detail::method_type_data* data_{};
|
||||||
friend auto detail::type_access<method_type>(const method_type&);
|
friend auto detail::type_access<method_type>(const method_type&);
|
||||||
@@ -1904,7 +1906,7 @@ namespace meta_hpp::detail
|
|||||||
const class_bitflags flags;
|
const class_bitflags flags;
|
||||||
const std::size_t size;
|
const std::size_t size;
|
||||||
const std::size_t align;
|
const std::size_t align;
|
||||||
const std::vector<any_type> argument_types;
|
const any_type_list argument_types;
|
||||||
|
|
||||||
class_set bases;
|
class_set bases;
|
||||||
constructor_map constructors;
|
constructor_map constructors;
|
||||||
@@ -1930,7 +1932,7 @@ namespace meta_hpp::detail
|
|||||||
struct constructor_type_data final : type_data_base {
|
struct constructor_type_data final : type_data_base {
|
||||||
const constructor_bitflags flags;
|
const constructor_bitflags flags;
|
||||||
const any_type class_type;
|
const any_type class_type;
|
||||||
const std::vector<any_type> argument_types;
|
const any_type_list argument_types;
|
||||||
|
|
||||||
template < class_kind Class, typename... Args >
|
template < class_kind Class, typename... Args >
|
||||||
explicit constructor_type_data(type_list<Class>, type_list<Args...>);
|
explicit constructor_type_data(type_list<Class>, type_list<Args...>);
|
||||||
@@ -1957,7 +1959,7 @@ namespace meta_hpp::detail
|
|||||||
struct function_type_data final : type_data_base {
|
struct function_type_data final : type_data_base {
|
||||||
const function_bitflags flags;
|
const function_bitflags flags;
|
||||||
const any_type return_type;
|
const any_type return_type;
|
||||||
const std::vector<any_type> argument_types;
|
const any_type_list argument_types;
|
||||||
|
|
||||||
template < function_kind Function >
|
template < function_kind Function >
|
||||||
explicit function_type_data(type_list<Function>);
|
explicit function_type_data(type_list<Function>);
|
||||||
@@ -1976,7 +1978,7 @@ namespace meta_hpp::detail
|
|||||||
const method_bitflags flags;
|
const method_bitflags flags;
|
||||||
const class_type owner_type;
|
const class_type owner_type;
|
||||||
const any_type return_type;
|
const any_type return_type;
|
||||||
const std::vector<any_type> argument_types;
|
const any_type_list argument_types;
|
||||||
|
|
||||||
template < method_kind Method >
|
template < method_kind Method >
|
||||||
explicit method_type_data(type_list<Method>);
|
explicit method_type_data(type_list<Method>);
|
||||||
@@ -3161,8 +3163,10 @@ namespace meta_hpp
|
|||||||
metadata_map metadata{};
|
metadata_map metadata{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using argument_opts_list = std::vector<argument_opts>;
|
||||||
|
|
||||||
struct constructor_opts final {
|
struct constructor_opts final {
|
||||||
std::vector<argument_opts> arguments{};
|
argument_opts_list arguments{};
|
||||||
metadata_map metadata{};
|
metadata_map metadata{};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3175,7 +3179,7 @@ namespace meta_hpp
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct function_opts final {
|
struct function_opts final {
|
||||||
std::vector<argument_opts> arguments{};
|
argument_opts_list arguments{};
|
||||||
metadata_map metadata{};
|
metadata_map metadata{};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3184,7 +3188,7 @@ namespace meta_hpp
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct method_opts final {
|
struct method_opts final {
|
||||||
std::vector<argument_opts> arguments{};
|
argument_opts_list arguments{};
|
||||||
metadata_map metadata{};
|
metadata_map metadata{};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3601,7 +3605,7 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
|
|
||||||
template < typename... Ts >
|
template < typename... Ts >
|
||||||
[[nodiscard]] std::vector<any_type> resolve_types() {
|
[[nodiscard]] any_type_list resolve_types() {
|
||||||
return { resolve_type<Ts>()... };
|
return { resolve_type<Ts>()... };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3614,7 +3618,7 @@ namespace meta_hpp
|
|||||||
}
|
}
|
||||||
|
|
||||||
template < typename... Ts >
|
template < typename... Ts >
|
||||||
[[nodiscard]] std::vector<any_type> resolve_types(type_list<Ts...>) {
|
[[nodiscard]] any_type_list resolve_types(type_list<Ts...>) {
|
||||||
return { resolve_type<Ts>()... };
|
return { resolve_type<Ts>()... };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4623,7 +4627,7 @@ namespace meta_hpp
|
|||||||
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const std::vector<any_type>& constructor_type::get_argument_types() const noexcept {
|
inline const any_type_list& constructor_type::get_argument_types() const noexcept {
|
||||||
return data_->argument_types;
|
return data_->argument_types;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5640,7 +5644,7 @@ namespace meta_hpp
|
|||||||
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const std::vector<any_type>& function_type::get_argument_types() const noexcept {
|
inline const any_type_list& function_type::get_argument_types() const noexcept {
|
||||||
return data_->argument_types;
|
return data_->argument_types;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6374,7 +6378,7 @@ namespace meta_hpp
|
|||||||
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const std::vector<any_type>& method_type::get_argument_types() const noexcept {
|
inline const any_type_list& method_type::get_argument_types() const noexcept {
|
||||||
return data_->argument_types;
|
return data_->argument_types;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6847,7 +6851,7 @@ namespace meta_hpp
|
|||||||
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
return position < data_->argument_types.size() ? data_->argument_types[position] : any_type{};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const std::vector<any_type>& class_type::get_argument_types() const noexcept {
|
inline const any_type_list& class_type::get_argument_types() const noexcept {
|
||||||
return data_->argument_types;
|
return data_->argument_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7049,7 +7053,7 @@ namespace meta_hpp
|
|||||||
template < typename Iter >
|
template < typename Iter >
|
||||||
constructor class_type::get_constructor_with(Iter first, Iter last) const noexcept {
|
constructor class_type::get_constructor_with(Iter first, Iter last) const noexcept {
|
||||||
for ( auto&& [index, ctor] : data_->constructors ) {
|
for ( auto&& [index, ctor] : data_->constructors ) {
|
||||||
const std::vector<any_type>& args = ctor.get_type().get_argument_types();
|
const any_type_list& args = ctor.get_type().get_argument_types();
|
||||||
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
||||||
return ctor;
|
return ctor;
|
||||||
}
|
}
|
||||||
@@ -7081,7 +7085,7 @@ namespace meta_hpp
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<any_type>& args = function.get_type().get_argument_types();
|
const any_type_list& args = function.get_type().get_argument_types();
|
||||||
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
||||||
return function;
|
return function;
|
||||||
}
|
}
|
||||||
@@ -7120,7 +7124,7 @@ namespace meta_hpp
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<any_type>& args = method.get_type().get_argument_types();
|
const any_type_list& args = method.get_type().get_argument_types();
|
||||||
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
@@ -7235,7 +7239,7 @@ namespace meta_hpp
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<any_type>& args = function.get_type().get_argument_types();
|
const any_type_list& args = function.get_type().get_argument_types();
|
||||||
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
if ( std::equal(first, last, args.begin(), args.end()) ) {
|
||||||
return function;
|
return function;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,17 +178,17 @@ TEST_CASE("meta/meta_states/scope") {
|
|||||||
meta::number_type double_type = meta::resolve_type<double>();
|
meta::number_type double_type = meta::resolve_type<double>();
|
||||||
|
|
||||||
CHECK_FALSE(math_scope.get_function_with<>("function_overloaded"));
|
CHECK_FALSE(math_scope.get_function_with<>("function_overloaded"));
|
||||||
CHECK(math_scope.get_function_with("function_overloaded", std::vector<meta::any_type>{int_type}));
|
CHECK(math_scope.get_function_with("function_overloaded", meta::any_type_list{int_type}));
|
||||||
CHECK_FALSE(math_scope.get_function_with("function_overloaded", std::vector<meta::any_type>{int_type, float_type}));
|
CHECK_FALSE(math_scope.get_function_with("function_overloaded", meta::any_type_list{int_type, float_type}));
|
||||||
|
|
||||||
CHECK_FALSE(math_scope.get_function_with("function_overloaded"));
|
CHECK_FALSE(math_scope.get_function_with("function_overloaded"));
|
||||||
CHECK_FALSE(math_scope.get_function_with("function_overloaded", std::vector<meta::any_type>{float_type}));
|
CHECK_FALSE(math_scope.get_function_with("function_overloaded", meta::any_type_list{float_type}));
|
||||||
CHECK(math_scope.get_function_with("function_overloaded", std::vector<meta::any_type>{int_type, int_type}));
|
CHECK(math_scope.get_function_with("function_overloaded", meta::any_type_list{int_type, int_type}));
|
||||||
CHECK_FALSE(math_scope.get_function_with("function_overloaded", std::vector<meta::any_type>{float_type, float_type}));
|
CHECK_FALSE(math_scope.get_function_with("function_overloaded", meta::any_type_list{float_type, float_type}));
|
||||||
|
|
||||||
CHECK_FALSE(math_scope.get_function_with<>("function_overloaded"));
|
CHECK_FALSE(math_scope.get_function_with<>("function_overloaded"));
|
||||||
CHECK_FALSE(math_scope.get_function_with("function_overloaded", std::vector<meta::any_type>{double_type}));
|
CHECK_FALSE(math_scope.get_function_with("function_overloaded", meta::any_type_list{double_type}));
|
||||||
CHECK_FALSE(math_scope.get_function_with("function_overloaded", std::vector<meta::any_type>{double_type, double_type}));
|
CHECK_FALSE(math_scope.get_function_with("function_overloaded", meta::any_type_list{double_type, double_type}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -176,17 +176,17 @@ TEST_CASE("meta/meta_types/class_type") {
|
|||||||
{
|
{
|
||||||
const meta::class_type type = meta::resolve_type<derived_clazz>();
|
const meta::class_type type = meta::resolve_type<derived_clazz>();
|
||||||
REQUIRE(type);
|
REQUIRE(type);
|
||||||
CHECK(type.get_argument_types() == std::vector<meta::any_type>{});
|
CHECK(type.get_argument_types() == meta::any_type_list{});
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const meta::class_type type = meta::resolve_type<variadic_clazz<int>>();
|
const meta::class_type type = meta::resolve_type<variadic_clazz<int>>();
|
||||||
REQUIRE(type);
|
REQUIRE(type);
|
||||||
CHECK(type.get_argument_types() == std::vector<meta::any_type>{meta::resolve_type<int>()});
|
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<int>()});
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const meta::class_type type = meta::resolve_type<variadic_clazz<int, float>>();
|
const meta::class_type type = meta::resolve_type<variadic_clazz<int, float>>();
|
||||||
REQUIRE(type);
|
REQUIRE(type);
|
||||||
CHECK(type.get_argument_types() == std::vector<meta::any_type>{meta::resolve_type<int>(), meta::resolve_type<float>()});
|
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<int>(), meta::resolve_type<float>()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,17 +438,17 @@ TEST_CASE("meta/meta_types/class_type") {
|
|||||||
meta::number_type double_type = meta::resolve_type<double>();
|
meta::number_type double_type = meta::resolve_type<double>();
|
||||||
|
|
||||||
CHECK_FALSE(base_clazz_1_type.get_function_with<>("base_function_1_overloaded"));
|
CHECK_FALSE(base_clazz_1_type.get_function_with<>("base_function_1_overloaded"));
|
||||||
CHECK(base_clazz_1_type.get_function_with("base_function_1_overloaded", std::vector<meta::any_type>{int_type}));
|
CHECK(base_clazz_1_type.get_function_with("base_function_1_overloaded", meta::any_type_list{int_type}));
|
||||||
CHECK_FALSE(base_clazz_1_type.get_function_with("base_function_1_overloaded", std::vector<meta::any_type>{int_type, float_type}));
|
CHECK_FALSE(base_clazz_1_type.get_function_with("base_function_1_overloaded", meta::any_type_list{int_type, float_type}));
|
||||||
|
|
||||||
CHECK_FALSE(base_clazz_1_type.get_function_with("base_function_1_overloaded"));
|
CHECK_FALSE(base_clazz_1_type.get_function_with("base_function_1_overloaded"));
|
||||||
CHECK_FALSE(base_clazz_1_type.get_function_with("base_function_1_overloaded", std::vector<meta::any_type>{float_type}));
|
CHECK_FALSE(base_clazz_1_type.get_function_with("base_function_1_overloaded", meta::any_type_list{float_type}));
|
||||||
CHECK(base_clazz_1_type.get_function_with("base_function_1_overloaded", std::vector<meta::any_type>{int_type, int_type}));
|
CHECK(base_clazz_1_type.get_function_with("base_function_1_overloaded", meta::any_type_list{int_type, int_type}));
|
||||||
CHECK_FALSE(base_clazz_1_type.get_function_with("base_function_1_overloaded", std::vector<meta::any_type>{float_type, float_type}));
|
CHECK_FALSE(base_clazz_1_type.get_function_with("base_function_1_overloaded", meta::any_type_list{float_type, float_type}));
|
||||||
|
|
||||||
CHECK_FALSE(base_clazz_1_type.get_function_with<>("base_function_1_overloaded"));
|
CHECK_FALSE(base_clazz_1_type.get_function_with<>("base_function_1_overloaded"));
|
||||||
CHECK_FALSE(base_clazz_1_type.get_function_with("base_function_1_overloaded", std::vector<meta::any_type>{double_type}));
|
CHECK_FALSE(base_clazz_1_type.get_function_with("base_function_1_overloaded", meta::any_type_list{double_type}));
|
||||||
CHECK_FALSE(base_clazz_1_type.get_function_with("base_function_1_overloaded", std::vector<meta::any_type>{double_type, double_type}));
|
CHECK_FALSE(base_clazz_1_type.get_function_with("base_function_1_overloaded", meta::any_type_list{double_type, double_type}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,16 +493,16 @@ TEST_CASE("meta/meta_types/class_type") {
|
|||||||
meta::number_type double_type = meta::resolve_type<double>();
|
meta::number_type double_type = meta::resolve_type<double>();
|
||||||
|
|
||||||
CHECK_FALSE(base_clazz_1_type.get_method_with<>("base_method_1_overloaded"));
|
CHECK_FALSE(base_clazz_1_type.get_method_with<>("base_method_1_overloaded"));
|
||||||
CHECK(base_clazz_1_type.get_method_with("base_method_1_overloaded", std::vector<meta::any_type>{int_type}));
|
CHECK(base_clazz_1_type.get_method_with("base_method_1_overloaded", meta::any_type_list{int_type}));
|
||||||
CHECK_FALSE(base_clazz_1_type.get_method_with("base_method_1_overloaded", std::vector<meta::any_type>{int_type, int_type}));
|
CHECK_FALSE(base_clazz_1_type.get_method_with("base_method_1_overloaded", meta::any_type_list{int_type, int_type}));
|
||||||
|
|
||||||
CHECK_FALSE(base_clazz_1_type.get_method_with("base_method_1_overloaded"));
|
CHECK_FALSE(base_clazz_1_type.get_method_with("base_method_1_overloaded"));
|
||||||
CHECK(base_clazz_1_type.get_method_with("base_method_1_overloaded", std::vector<meta::any_type>{float_type}));
|
CHECK(base_clazz_1_type.get_method_with("base_method_1_overloaded", meta::any_type_list{float_type}));
|
||||||
CHECK_FALSE(base_clazz_1_type.get_method_with("base_method_1_overloaded", std::vector<meta::any_type>{float_type, float_type}));
|
CHECK_FALSE(base_clazz_1_type.get_method_with("base_method_1_overloaded", meta::any_type_list{float_type, float_type}));
|
||||||
|
|
||||||
CHECK_FALSE(base_clazz_1_type.get_method_with<>("base_method_1_overloaded"));
|
CHECK_FALSE(base_clazz_1_type.get_method_with<>("base_method_1_overloaded"));
|
||||||
CHECK_FALSE(base_clazz_1_type.get_method_with("base_method_1_overloaded", std::vector<meta::any_type>{double_type}));
|
CHECK_FALSE(base_clazz_1_type.get_method_with("base_method_1_overloaded", meta::any_type_list{double_type}));
|
||||||
CHECK_FALSE(base_clazz_1_type.get_method_with("base_method_1_overloaded", std::vector<meta::any_type>{double_type, double_type}));
|
CHECK_FALSE(base_clazz_1_type.get_method_with("base_method_1_overloaded", meta::any_type_list{double_type, double_type}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ TEST_CASE("meta/meta_types/function_type") {
|
|||||||
|
|
||||||
CHECK(type.get_arity() == 1);
|
CHECK(type.get_arity() == 1);
|
||||||
CHECK(type.get_return_type() == meta::resolve_type<void>());
|
CHECK(type.get_return_type() == meta::resolve_type<void>());
|
||||||
CHECK(type.get_argument_types() == std::vector<meta::any_type>{meta::resolve_type<ivec2>()});
|
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<ivec2>()});
|
||||||
|
|
||||||
CHECK(type.get_argument_type(0) == meta::resolve_type<ivec2>());
|
CHECK(type.get_argument_type(0) == meta::resolve_type<ivec2>());
|
||||||
CHECK_FALSE(type.get_argument_type(1));
|
CHECK_FALSE(type.get_argument_type(1));
|
||||||
@@ -53,7 +53,7 @@ TEST_CASE("meta/meta_types/function_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_flags() == meta::function_flags::is_noexcept);
|
||||||
CHECK(type.get_argument_types() == std::vector<meta::any_type>{meta::resolve_type<ivec2&>()});
|
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<ivec2&>()});
|
||||||
|
|
||||||
CHECK(type.get_argument_type(0) == meta::resolve_type<ivec2&>());
|
CHECK(type.get_argument_type(0) == meta::resolve_type<ivec2&>());
|
||||||
CHECK_FALSE(type.get_argument_type(1));
|
CHECK_FALSE(type.get_argument_type(1));
|
||||||
@@ -65,7 +65,7 @@ TEST_CASE("meta/meta_types/function_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_flags() == meta::function_flags::is_noexcept);
|
||||||
CHECK(type.get_argument_types() == std::vector<meta::any_type>{meta::resolve_type<const ivec2&>()});
|
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<const ivec2&>()});
|
||||||
|
|
||||||
CHECK(type.get_argument_type(0) == meta::resolve_type<const ivec2&>());
|
CHECK(type.get_argument_type(0) == meta::resolve_type<const ivec2&>());
|
||||||
CHECK_FALSE(type.get_argument_type(1));
|
CHECK_FALSE(type.get_argument_type(1));
|
||||||
@@ -77,7 +77,7 @@ TEST_CASE("meta/meta_types/function_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_flags() == meta::function_flags{});
|
||||||
CHECK(type.get_argument_types() == std::vector<meta::any_type>{meta::resolve_type<ivec2*>()});
|
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<ivec2*>()});
|
||||||
|
|
||||||
CHECK(type.get_argument_type(0) == meta::resolve_type<ivec2*>());
|
CHECK(type.get_argument_type(0) == meta::resolve_type<ivec2*>());
|
||||||
CHECK_FALSE(type.get_argument_type(1));
|
CHECK_FALSE(type.get_argument_type(1));
|
||||||
@@ -89,7 +89,7 @@ TEST_CASE("meta/meta_types/function_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_flags() == meta::function_flags{});
|
||||||
CHECK(type.get_argument_types() == std::vector<meta::any_type>{meta::resolve_type<ivec2*>()});
|
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<ivec2*>()});
|
||||||
|
|
||||||
CHECK(type.get_argument_type(0) == meta::resolve_type<ivec2*>());
|
CHECK(type.get_argument_type(0) == meta::resolve_type<ivec2*>());
|
||||||
CHECK_FALSE(type.get_argument_type(1));
|
CHECK_FALSE(type.get_argument_type(1));
|
||||||
@@ -101,7 +101,7 @@ TEST_CASE("meta/meta_types/function_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_flags() == meta::function_flags{});
|
||||||
CHECK(type.get_argument_types() == std::vector<meta::any_type>{meta::resolve_type<const ivec2*>()});
|
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<const ivec2*>()});
|
||||||
|
|
||||||
CHECK(type.get_argument_type(0) == meta::resolve_type<const ivec2*>());
|
CHECK(type.get_argument_type(0) == meta::resolve_type<const ivec2*>());
|
||||||
CHECK_FALSE(type.get_argument_type(1));
|
CHECK_FALSE(type.get_argument_type(1));
|
||||||
@@ -113,7 +113,7 @@ TEST_CASE("meta/meta_types/function_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_flags() == meta::function_flags{});
|
||||||
CHECK(type.get_argument_types() == std::vector<meta::any_type>{meta::resolve_type<const ivec2*>()});
|
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<const ivec2*>()});
|
||||||
|
|
||||||
CHECK(type.get_argument_type(0) == meta::resolve_type<const ivec2*>());
|
CHECK(type.get_argument_type(0) == meta::resolve_type<const ivec2*>());
|
||||||
CHECK_FALSE(type.get_argument_type(1));
|
CHECK_FALSE(type.get_argument_type(1));
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ TEST_CASE("meta/meta_types/method_type") {
|
|||||||
CHECK(type.get_arity() == 1);
|
CHECK(type.get_arity() == 1);
|
||||||
CHECK(type.get_owner_type() == meta::resolve_type<ivec2>());
|
CHECK(type.get_owner_type() == meta::resolve_type<ivec2>());
|
||||||
CHECK(type.get_return_type() == meta::resolve_type<int&>());
|
CHECK(type.get_return_type() == meta::resolve_type<int&>());
|
||||||
CHECK(type.get_argument_types() == std::vector<meta::any_type>{meta::resolve_type<std::size_t>()});
|
CHECK(type.get_argument_types() == meta::any_type_list{meta::resolve_type<std::size_t>()});
|
||||||
|
|
||||||
CHECK(type.get_argument_type(0) == meta::resolve_type<std::size_t>());
|
CHECK(type.get_argument_type(0) == meta::resolve_type<std::size_t>());
|
||||||
CHECK_FALSE(type.get_argument_type(1));
|
CHECK_FALSE(type.get_argument_type(1));
|
||||||
@@ -61,7 +61,7 @@ TEST_CASE("meta/meta_types/method_type") {
|
|||||||
CHECK(type.get_arity() == 0);
|
CHECK(type.get_arity() == 0);
|
||||||
CHECK(type.get_owner_type() == meta::resolve_type<ivec2>());
|
CHECK(type.get_owner_type() == meta::resolve_type<ivec2>());
|
||||||
CHECK(type.get_return_type() == meta::resolve_type<int>());
|
CHECK(type.get_return_type() == meta::resolve_type<int>());
|
||||||
CHECK(type.get_argument_types() == std::vector<meta::any_type>{});
|
CHECK(type.get_argument_types() == meta::any_type_list{});
|
||||||
|
|
||||||
CHECK_FALSE(type.get_argument_type(0));
|
CHECK_FALSE(type.get_argument_type(0));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user