From 17c0bcec75f1e61a351c535ced11cc80bc8adb29 Mon Sep 17 00:00:00 2001 From: Matt Kuruc Date: Tue, 24 Oct 2023 13:16:58 -0700 Subject: [PATCH] Replace `std::is_trivially_assignable` with `std::is_trivially_copy_assignable` --- pxr/base/vt/traits.h | 4 +--- pxr/base/vt/value.h | 10 ++++------ pxr/usd/usd/crateFile.cpp | 11 ++++------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/pxr/base/vt/traits.h b/pxr/base/vt/traits.h index f5739585bf..33ff769a60 100644 --- a/pxr/base/vt/traits.h +++ b/pxr/base/vt/traits.h @@ -44,10 +44,8 @@ struct VtIsArray : public std::false_type {}; // space but do not have a trivial assignment are not cheap to copy. E.g. std:: // containers. Clients can specialize this template for their own types that // aren't trivially assignable but are cheap to copy to enable local storage. -// In C++17, std::is_trivially_copy_assignable could be used in place of -// std::is_trivially_assignable template -struct VtValueTypeHasCheapCopy : std::is_trivially_assignable {}; +struct VtValueTypeHasCheapCopy : std::is_trivially_copy_assignable {}; #define VT_TYPE_IS_CHEAP_TO_COPY(T) \ template <> struct VtValueTypeHasCheapCopy \ diff --git a/pxr/base/vt/value.h b/pxr/base/vt/value.h index 9568252fca..793d55f3e1 100644 --- a/pxr/base/vt/value.h +++ b/pxr/base/vt/value.h @@ -197,14 +197,12 @@ class VtValue typedef std::aligned_storage< /* size */_MaxLocalSize, /* alignment */_MaxLocalSize>::type _Storage; - // In C++17, std::is_trivially_copy_assignable could be used in place of - // std::is_trivially_assignable template using _IsTriviallyCopyable = std::integral_constant::value && - std::is_trivially_copyable::value && - std::is_trivially_assignable::value && - std::is_trivially_destructible::value>; + std::is_trivially_default_constructible_v && + std::is_trivially_copyable_v && + std::is_trivially_copy_assignable_v && + std::is_trivially_destructible_v>; // Metafunction that returns true if T should be stored locally, false if it // should be stored remotely. diff --git a/pxr/usd/usd/crateFile.cpp b/pxr/usd/usd/crateFile.cpp index fa3033dd3d..024b6bb7fe 100644 --- a/pxr/usd/usd/crateFile.cpp +++ b/pxr/usd/usd/crateFile.cpp @@ -320,13 +320,10 @@ namespace Usd_CrateFile { // XXX: These checks ensure VtValue can hold ValueRep in the lightest // possible way -- WBN not to rely on internal knowledge of that. -static_assert(std::is_trivially_constructible::value, ""); -static_assert(std::is_trivially_copyable::value, ""); -// In C++17, std::is_trivially_copy_assignable could be used in place of -// std::is_trivially_assignable -static_assert(std::is_trivially_assignable::value, - ""); -static_assert(std::is_trivially_destructible::value, ""); +static_assert(std::is_trivially_constructible_v); +static_assert(std::is_trivially_copyable_v); +static_assert(std::is_trivially_copy_assignable_v); +static_assert(std::is_trivially_destructible_v); using namespace Usd_CrateValueInliners;