Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace boost traits and mpl with STL traits in pxr/usd/sdf, pxr/usd/pcp, and pxr/usd/usd #2214

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pxr/usd/pcp/iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,10 @@ class PcpPropertyReverseIterator
}; \
\
template <> \
struct Tf_ShouldIterateOverCopy<Range> : boost::true_type {}; \
struct Tf_ShouldIterateOverCopy<Range> : std::true_type {}; \
\
template <> \
struct Tf_ShouldIterateOverCopy<const Range> : boost::true_type {}
struct Tf_ShouldIterateOverCopy<const Range> : std::true_type {}

PCP_DEFINE_RANGE(PcpNodeRange, PcpNodeIterator, PcpNodeReverseIterator);
PCP_DEFINE_RANGE(PcpPrimRange, PcpPrimIterator, PcpPrimReverseIterator);
Expand Down
2 changes: 1 addition & 1 deletion pxr/usd/pcp/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ struct Tf_IteratorInterface<PcpNodeRef::child_const_range, true> {

template <>
struct Tf_ShouldIterateOverCopy<PcpNodeRef::child_const_range> :
boost::true_type {};
std::true_type {};

/// Support for range-based for loops for PcpNodeRef children ranges.
inline
Expand Down
2 changes: 1 addition & 1 deletion pxr/usd/pcp/node_Iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ struct Tf_IteratorInterface<PcpNodeRef_PrivateChildrenConstRange, true> {
};
template <>
struct Tf_ShouldIterateOverCopy<PcpNodeRef_PrivateChildrenConstRange> :
boost::true_type {};
std::true_type {};

// Wrap a node for use by TF_FOR_ALL().
inline
Expand Down
4 changes: 3 additions & 1 deletion pxr/usd/sdf/accessorHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include "pxr/usd/sdf/spec.h"
#include "pxr/usd/sdf/types.h"

#include <type_traits>

// This file defines macros intended to reduce the amount of boilerplate code
// associated with adding new metadata to SdfSpec subclasses. There's still a
// lot of files to touch, but these at least reduce the copy/paste/edit load.
Expand Down Expand Up @@ -203,7 +205,7 @@ SDF_DEFINE_DICTIONARY_SET(setName_, key_)
// spec. These templates capture those differences.

template <class T,
bool IsForSpec = boost::is_base_of<SdfSpec, T>::value>
bool IsForSpec = std::is_base_of<SdfSpec, T>::value>
struct Sdf_AccessorHelpers;

template <class T>
Expand Down
2 changes: 1 addition & 1 deletion pxr/usd/sdf/childrenProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ class SdfChildrenProxy : boost::equality_comparable<SdfChildrenProxy<_View> > {

// Allow TfIteration over children proxies.
template <typename _View>
struct Tf_ShouldIterateOverCopy<SdfChildrenProxy<_View> > : boost::true_type
struct Tf_ShouldIterateOverCopy<SdfChildrenProxy<_View> > : std::true_type
{
};

Expand Down
2 changes: 1 addition & 1 deletion pxr/usd/sdf/childrenView.h
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ struct SdfAdaptedChildrenViewCreator

// Allow TfIteration over children views.
template <typename C, typename P, typename A>
struct Tf_ShouldIterateOverCopy<SdfChildrenView<C, P, A> > : boost::true_type
struct Tf_ShouldIterateOverCopy<SdfChildrenView<C, P, A> > : std::true_type
{
};
template <typename C, typename P, typename A>
Expand Down
22 changes: 10 additions & 12 deletions pxr/usd/sdf/listProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@
#include <boost/iterator/reverse_iterator.hpp>
#include <boost/operators.hpp>
#include <boost/optional.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_reference.hpp>

#include <memory>
#include <type_traits>

PXR_NAMESPACE_OPEN_SCOPE

Expand Down Expand Up @@ -126,23 +124,23 @@ class SdfListProxy :
class _Iterator :
public boost::iterator_facade<
_Iterator<Owner, GetItem>,
typename boost::remove_cv<
typename boost::remove_reference<
std::remove_cv_t<
std::remove_reference_t<
typename GetItem::result_type
>::type
>::type,
>
>,
std::random_access_iterator_tag,
typename GetItem::result_type> {
public:
typedef _Iterator<Owner, GetItem> This;
typedef
boost::iterator_facade<
_Iterator<Owner, GetItem>,
typename boost::remove_cv<
typename boost::remove_reference<
std::remove_cv_t<
std::remove_reference_t<
typename GetItem::result_type
>::type
>::type,
>
>,
std::random_access_iterator_tag,
typename GetItem::result_type> Parent;
typedef typename Parent::reference reference;
Expand Down Expand Up @@ -627,7 +625,7 @@ class SdfListProxy :

// Allow TfIteration over list proxies.
template <typename T>
struct Tf_ShouldIterateOverCopy<SdfListProxy<T> > : boost::true_type
struct Tf_ShouldIterateOverCopy<SdfListProxy<T> > : std::true_type
{
};

Expand Down
3 changes: 0 additions & 3 deletions pxr/usd/sdf/spec.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
#include "pxr/base/tf/token.h"
#include "pxr/base/tf/type.h"

#include <boost/type_traits/is_base_of.hpp>
#include <boost/utility/enable_if.hpp>

#include <iosfwd>

PXR_NAMESPACE_OPEN_SCOPE
Expand Down
11 changes: 7 additions & 4 deletions pxr/usd/usd/crateFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,13 @@ 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(boost::has_trivial_constructor<ValueRep>::value, "");
static_assert(boost::has_trivial_copy<ValueRep>::value, "");
static_assert(boost::has_trivial_assign<ValueRep>::value, "");
static_assert(boost::has_trivial_destructor<ValueRep>::value, "");
static_assert(std::is_trivially_constructible<ValueRep>::value, "");
static_assert(std::is_trivially_copyable<ValueRep>::value, "");
// In C++17, std::is_trivially_copy_assignable<T> could be used in place of
// std::is_trivially_assignable
static_assert(std::is_trivially_assignable<ValueRep&, const ValueRep&>::value,
"");
static_assert(std::is_trivially_destructible<ValueRep>::value, "");

using namespace Usd_CrateValueInliners;

Expand Down
8 changes: 4 additions & 4 deletions pxr/usd/usd/prim.h
Original file line number Diff line number Diff line change
Expand Up @@ -2362,10 +2362,10 @@ typedef boost::iterator_range<UsdPrimSiblingIterator> UsdPrimSiblingRange;
// Inform TfIterator it should feel free to make copies of the range type.
template <>
struct Tf_ShouldIterateOverCopy<
UsdPrimSiblingRange> : boost::true_type {};
UsdPrimSiblingRange> : std::true_type {};
template <>
struct Tf_ShouldIterateOverCopy<
const UsdPrimSiblingRange> : boost::true_type {};
const UsdPrimSiblingRange> : std::true_type {};

#endif // doxygen

Expand Down Expand Up @@ -2560,10 +2560,10 @@ typedef boost::iterator_range<UsdPrimSubtreeIterator> UsdPrimSubtreeRange;
// Inform TfIterator it should feel free to make copies of the range type.
template <>
struct Tf_ShouldIterateOverCopy<
UsdPrimSubtreeRange> : boost::true_type {};
UsdPrimSubtreeRange> : std::true_type {};
template <>
struct Tf_ShouldIterateOverCopy<
const UsdPrimSubtreeRange> : boost::true_type {};
const UsdPrimSubtreeRange> : std::true_type {};

#endif // doxygen

Expand Down
8 changes: 4 additions & 4 deletions pxr/usd/usd/primData.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,10 @@ typedef boost::iterator_range<
// Inform TfIterator it should feel free to make copies of the range type.
template <>
struct Tf_ShouldIterateOverCopy<
Usd_PrimDataSiblingRange> : boost::true_type {};
Usd_PrimDataSiblingRange> : std::true_type {};
template <>
struct Tf_ShouldIterateOverCopy<
const Usd_PrimDataSiblingRange> : boost::true_type {};
const Usd_PrimDataSiblingRange> : std::true_type {};

Usd_PrimDataSiblingIterator
Usd_PrimData::_ChildrenBegin() const
Expand Down Expand Up @@ -448,10 +448,10 @@ typedef boost::iterator_range<
// Inform TfIterator it should feel free to make copies of the range type.
template <>
struct Tf_ShouldIterateOverCopy<
Usd_PrimDataSubtreeRange> : boost::true_type {};
Usd_PrimDataSubtreeRange> : std::true_type {};
template <>
struct Tf_ShouldIterateOverCopy<
const Usd_PrimDataSubtreeRange> : boost::true_type {};
const Usd_PrimDataSubtreeRange> : std::true_type {};

Usd_PrimDataSubtreeIterator
Usd_PrimData::_SubtreeBegin() const
Expand Down