-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
I'd love it if any_regular had a holds<T> routine (similar to std::variant). It would make checking for the type of the thing within the regular much more terse and easy to read.
Old:
if (my_regular.type_info() = typeid(dictionary_t)) {...New:
if (my_regular.holds<dictionary_t>()) {...Another option would be a routine that returns a pointer, so if the underlying type matches the caller doesn't have to go back in to get the value. This example is a free function but a member function would work as well:
template <class T>
inline const T* holds_cast(const adobe::any_regular_t& x) {
if (x.holds<T>()) {
return &x.cast<T>();
}
return nullptr;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels