Wrap with store
This commit is contained in:
parent
e662d0031e
commit
29a2938193
1 changed files with 9 additions and 1 deletions
|
@ -988,6 +988,14 @@ From get_base_type(Type From::*);
|
||||||
template <typename T>
|
template <typename T>
|
||||||
extern T nonexist_object;
|
extern T nonexist_object;
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct Store {
|
||||||
|
T v;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
Store(T) -> Store<T>;
|
||||||
|
|
||||||
template <auto V>
|
template <auto V>
|
||||||
consteval auto get_member_name() noexcept {
|
consteval auto get_member_name() noexcept {
|
||||||
if constexpr (std::is_member_function_pointer_v<decltype(V)>) {
|
if constexpr (std::is_member_function_pointer_v<decltype(V)>) {
|
||||||
|
@ -996,7 +1004,7 @@ consteval auto get_member_name() noexcept {
|
||||||
constexpr bool is_defined = sizeof(decltype(get_base_type(V))) != 0;
|
constexpr bool is_defined = sizeof(decltype(get_base_type(V))) != 0;
|
||||||
static_assert(is_defined, "nameof::nameof_member member name can use only if the struct is already fully defined. Please use NAMEOF macro, or separate definition and declaration.");
|
static_assert(is_defined, "nameof::nameof_member member name can use only if the struct is already fully defined. Please use NAMEOF macro, or separate definition and declaration.");
|
||||||
if constexpr (is_defined) {
|
if constexpr (is_defined) {
|
||||||
return n<V, &(nonexist_object<decltype(get_base_type(V))>.*V)>();
|
return n<V, Store{&(nonexist_object<decltype(get_base_type(V))>.*V)}>();
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue