24 #ifndef PXR_BASE_VT_VISIT_VALUE_H 25 #define PXR_BASE_VT_VISIT_VALUE_H 29 #include "pxr/base/vt/value.h" 31 PXR_NAMESPACE_OPEN_SCOPE
33 namespace Vt_ValueVisitDetail {
38 template <
class T,
class Visitor,
39 class = decltype(std::declval<Visitor>()(std::declval<T>()))>
41 Visit(
VtValue const &val, Visitor &&visitor,
int) {
42 return std::forward<Visitor>(visitor)(val.
UncheckedGet<T>());
45 template <
class T,
class Visitor>
47 Visit(
VtValue const &val, Visitor &&visitor, ...) {
48 return std::forward<Visitor>(visitor)(val);
104 template <
class Visitor>
105 auto VtVisitValue(
VtValue const &value, Visitor &&visitor)
112 #define VT_CASE_FOR_TYPE_INDEX(r, unused, i, elem) \ 114 return Vt_ValueVisitDetail::Visit<VT_TYPE(elem)>( \ 115 value, std::forward<Visitor>(visitor), 0); \ 117 BOOST_PP_SEQ_FOR_EACH_I(VT_CASE_FOR_TYPE_INDEX, ~, VT_VALUE_TYPES)
118 #undef VT_CASE_FOR_TYPE_INDEX 122 return Vt_ValueVisitDetail::Visit<VtValue>(
123 value, std::forward<Visitor>(visitor), 0);
128 PXR_NAMESPACE_CLOSE_SCOPE
130 #endif // PXR_BASE_VT_VISIT_VALUE_H T const & UncheckedGet() const &
Returns a const reference to the held object if the held object is of type T.
int GetKnownValueTypeIndex() const
Return VtKnownValueTypeIndex<T> for the held type T.
Provides a container which may hold any type, and provides introspection and iteration over array typ...