You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It can be probably implemented in a library, not in the base standard, but I found no way to implement it (using get_public_member_functions), after spending 3 hours trying.
This can be done in C++ with contepts, but the problem with concept is that it must be first defined out of the place it is used, making the usage harder:
template <classT>
concept HasFoo = requires (T t) { t.foo(0); };
/// some other codeifconstexpr (HasFoo<decltype(a)>) {
a.foo(x);
}
which is far from acceptable. This is because concepts cannot be defined locally in functions.
So I believe this deserves specialization, or at least a defined utility to extract by name from ObjectSequence (in case of overloaded functions in a aggregate type, would be fine to emit compile error).
The text was updated successfully, but these errors were encountered:
It can be probably implemented in a library, not in the base standard, but I found no way to implement it (using
get_public_member_functions
), after spending 3 hours trying.I want just:
or something equivalently short.
D language has this using:
and
(there is also a library helper for the first one:
)
See https://dlang.org/spec/traits.html#hasMember and https://dlang.org/phobos/std_traits.html#hasMember
This can be done in C++ with contepts, but the problem with concept is that it must be first defined out of the place it is used, making the usage harder:
which is far from acceptable. This is because concepts cannot be defined locally in functions.
So I believe this deserves specialization, or at least a defined utility to extract by name from
ObjectSequence
(in case of overloaded functions in a aggregate type, would be fine to emit compile error).The text was updated successfully, but these errors were encountered: