Skip to content

Commit

Permalink
Replace std::is_trivially_assignable with `std::is_trivially_copy_a…
Browse files Browse the repository at this point in the history
…ssignable`
  • Loading branch information
nvmkuruc committed Oct 24, 2023
1 parent ec33ec0 commit 2f15879
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 1 addition & 3 deletions pxr/base/vt/traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> could be used in place of
// std::is_trivially_assignable
template <class T>
struct VtValueTypeHasCheapCopy : std::is_trivially_assignable<T&, const T&> {};
struct VtValueTypeHasCheapCopy : std::is_trivially_copy_assignable<T> {};

#define VT_TYPE_IS_CHEAP_TO_COPY(T) \
template <> struct VtValueTypeHasCheapCopy<TF_PP_EAT_PARENS(T)> \
Expand Down
10 changes: 4 additions & 6 deletions pxr/base/vt/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,12 @@ class VtValue
typedef std::aligned_storage<
/* size */_MaxLocalSize, /* alignment */_MaxLocalSize>::type _Storage;

// In C++17, std::is_trivially_copy_assignable<T> could be used in place of
// std::is_trivially_assignable
template <class T>
using _IsTriviallyCopyable = std::integral_constant<bool,
std::is_trivially_default_constructible<T>::value &&
std::is_trivially_copyable<T>::value &&
std::is_trivially_assignable<T&, const T&>::value &&
std::is_trivially_destructible<T>::value>;
std::is_trivially_default_constructible_v<T> &&
std::is_trivially_copyable_v<T> &&
std::is_trivially_copy_assignable_v<T> &&
std::is_trivially_destructible_v<T>>;

// Metafunction that returns true if T should be stored locally, false if it
// should be stored remotely.
Expand Down

0 comments on commit 2f15879

Please sign in to comment.