24#ifndef PXR_BASE_VT_VISIT_VALUE_H
25#define PXR_BASE_VT_VISIT_VALUE_H
29#include "pxr/base/vt/value.h"
31PXR_NAMESPACE_OPEN_SCOPE
33namespace Vt_ValueVisitDetail {
38template <
class T,
class Visitor,
39 class =
decltype(std::declval<Visitor>()(std::declval<T>()))>
41Visit(
VtValue const &val, Visitor &&visitor,
int) {
42 return std::forward<Visitor>(visitor)(val.
UncheckedGet<T>());
45template <
class T,
class Visitor>
47Visit(
VtValue const &val, Visitor &&visitor, ...) {
48 return std::forward<Visitor>(visitor)(val);
104template <
class Visitor>
105auto 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); \
117BOOST_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);
128PXR_NAMESPACE_CLOSE_SCOPE
Provides a container which may hold any type, and provides introspection and iteration over array typ...
int GetKnownValueTypeIndex() const
Return VtKnownValueTypeIndex<T> for the held type T.
T const & UncheckedGet() const &
Returns a const reference to the held object if the held object is of type T.