-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 usage of boost::compressed_pair
with explicit empty base optimization
#2259
Replace usage of boost::compressed_pair
with explicit empty base optimization
#2259
Conversation
Filed as internal issue #USD-7993 |
73706ca
to
af09f6c
Compare
af09f6c
to
7f8ab2d
Compare
@@ -56,7 +54,13 @@ template < | |||
class EqualKey = std::equal_to<Key>, | |||
unsigned Threshold = 128 | |||
> | |||
class TfDenseHashMap | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, we don't want to do this this way. The semantics of TfDenseHashMap now BEING a HashFn and an EqualKey is not desirable.
What I think you really want to do is reimplement the internal member class _VectorHashFnEqualFn using empty base optimization explicitly instead of the compressed_pair
pxr/base/tf/denseHashSet.h
Outdated
@@ -55,7 +53,12 @@ template < | |||
class EqualElement = std::equal_to<Element>, | |||
unsigned Threshold = 128 | |||
> | |||
class TfDenseHashSet | |||
class TfDenseHashSet : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here; we don't want the DenseHashSet inheriting from these function types.
7f8ab2d
to
ee942c3
Compare
Description of Change(s)
TfDenseHash{Set,Map}
to explicitly use private inheritance to take advantage of the empty base optimization instead of indirectly throughboost::compressed_pair
HashFn
, andEquality{Key,Element}
in constructorsstd::make_unique
instead ofnew
operator (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rr-make_unique)HashFn
, andEquality{Key,Element}
inswap
methodscompressed_pair
in test forTfDenseHashMap
utility.hpp
inpxr/base/tf/denseHash{Set,Map}.h
boost/compressed_pair.hpp
inpxr/usd/sdf/childrenView.h
Fixes Issue(s)
boost::compressed_pair
can be replaced with explicit empty base optimization #2257