mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-14 11:40:35 +07:00
get_as<T> for variable and member
This commit is contained in:
@@ -254,6 +254,9 @@ namespace meta_hpp
|
||||
template < typename Instance >
|
||||
[[nodiscard]] uvalue get(Instance&& instance) const;
|
||||
|
||||
template < typename T, typename Instance >
|
||||
[[nodiscard]] T get_as(Instance&& instance) const;
|
||||
|
||||
template < typename Instance, typename Value >
|
||||
void set(Instance&& instance, Value&& value) const;
|
||||
|
||||
@@ -363,6 +366,9 @@ namespace meta_hpp
|
||||
|
||||
[[nodiscard]] uvalue get() const;
|
||||
|
||||
template < typename T >
|
||||
[[nodiscard]] T get_as() const;
|
||||
|
||||
template < typename Value >
|
||||
void set(Value&& value) const;
|
||||
|
||||
|
||||
@@ -200,6 +200,11 @@ namespace meta_hpp
|
||||
return state_->getter(vinst);
|
||||
}
|
||||
|
||||
template < typename T, typename Instance >
|
||||
T member::get_as(Instance&& instance) const {
|
||||
return get(std::forward<Instance>(instance)).template get_as<T>();
|
||||
}
|
||||
|
||||
template < typename Instance, typename Value >
|
||||
void member::set(Instance&& instance, Value&& value) const {
|
||||
using namespace detail;
|
||||
|
||||
@@ -145,6 +145,11 @@ namespace meta_hpp
|
||||
return state_->getter();
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
T variable::get_as() const {
|
||||
return get().get_as<T>();
|
||||
}
|
||||
|
||||
template < typename Value >
|
||||
void variable::set(Value&& value) const {
|
||||
using namespace detail;
|
||||
|
||||
Reference in New Issue
Block a user