From 266fcfaa4892ff04e4da59c8d0c45daba96a7835 Mon Sep 17 00:00:00 2001 From: Matt Kuruc Date: Thu, 6 Jul 2023 21:07:16 -0700 Subject: [PATCH] Replace `boost::call_traits` in `pxr/usd/sdf/accessorHelpers.h` --- pxr/usd/sdf/accessorHelpers.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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_) \