Skip to content

Commit

Permalink
usd: Simplify CrateFile::_ValueHandler type hierarchy using C++17's 'if
Browse files Browse the repository at this point in the history
constexpr()'.  This type hierarchy existed to let us simultaneously share
common code among all the kinds of value types (inlined-vs-not,
array-supporting-vs-not) while not instantiating code that wouldn't be valid
for one type or another.

Happily, 'if constexpr()' will totally discard the appropriate 'if' or 'else'
branch, giving us a cleaner way to achieve these goals.  This change collapses
the old type hierarchy:

_ValueHandlerBase <- _ScalarValueHandlerBase<T> <-
    _ArrayValueHandlerBase<T> <- _ValueHandler<T>

To simply:

_ValueHandlerBase <- _ValueHandler<T>

And the type-based special cases are handled locally within the methods of
_ValueHandler<T> via 'if constexpr()' rather than spread across the different
subclasses.

(Internal change: 2308134)
  • Loading branch information
gitamohr authored and pixar-oss committed Dec 10, 2023
1 parent 2dda6c4 commit e4df120
Show file tree
Hide file tree
Showing 2 changed files with 390 additions and 462 deletions.
Loading

0 comments on commit e4df120

Please sign in to comment.