diff --git a/pxr/usd/sdf/accessorHelpers.h b/pxr/usd/sdf/accessorHelpers.h index ef3817d787..014d2ed104 100644 --- a/pxr/usd/sdf/accessorHelpers.h +++ b/pxr/usd/sdf/accessorHelpers.h @@ -173,6 +173,13 @@ SDF_ACCESSOR_CLASS::name_( \ // Convenience macros to provide common combinations of value accessors +// Convert non-trivial types like `std::string` to `const std::string&` while +// preserving the type for `int`, `bool`, `char`, etc. +template +using Sdf_SetParameter = std::conditional< + std::is_arithmetic::value, std::add_const_t, + std::add_lvalue_reference_t>>; + #define SDF_DEFINE_TYPED_GET_SET(name_, key_, getType_, setType_) \ SDF_DEFINE_GET(name_, key_, getType_) \ SDF_DEFINE_SET(name_, key_, setType_) @@ -184,11 +191,11 @@ SDF_DEFINE_CLEAR(name_, key_) #define SDF_DEFINE_GET_SET(name_, key_, type_) \ SDF_DEFINE_TYPED_GET_SET(name_, key_, type_, \ - boost::call_traits::param_type) + Sdf_SetParameter::type) #define SDF_DEFINE_GET_SET_HAS_CLEAR(name_, key_, type_) \ SDF_DEFINE_TYPED_GET_SET_HAS_CLEAR(name_, key_, type_, \ - boost::call_traits::param_type) + Sdf_SetParameter::type) #define SDF_DEFINE_IS_SET(name_, key_) \ SDF_DEFINE_IS(name_, key_) \