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::in_place with emplace method #2291

Merged
merged 1 commit into from
Mar 2, 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
5 changes: 2 additions & 3 deletions pxr/base/tf/type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@

#include <boost/noncopyable.hpp>
#include <boost/optional.hpp>
#include <boost/utility/in_place_factory.hpp>

#include <atomic>
#include <algorithm>
Expand Down Expand Up @@ -279,11 +278,11 @@ class Tf_TypeRegistry : boost::noncopyable
}

if (!base->aliasToDerivedTypeMap)
base->aliasToDerivedTypeMap = boost::in_place(0);
base->aliasToDerivedTypeMap.emplace(0);
(*base->aliasToDerivedTypeMap)[alias] = derived;

if (!base->derivedTypeToAliasesMap)
base->derivedTypeToAliasesMap = boost::in_place(0);
base->derivedTypeToAliasesMap.emplace(0);
(*base->derivedTypeToAliasesMap)[derived].push_back(alias);
}

Expand Down
7 changes: 3 additions & 4 deletions pxr/usd/usd/stage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@

#include <boost/optional.hpp>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/utility/in_place_factory.hpp>

#include <tbb/spin_rw_mutex.h>
#include <tbb/spin_mutex.h>
Expand Down Expand Up @@ -852,7 +851,7 @@ _OpenLayer(
{
boost::optional<ArResolverContextBinder> binder;
if (!resolverContext.IsEmpty())
binder = boost::in_place(resolverContext);
binder.emplace(resolverContext);

SdfLayer::FileFormatArguments args;
args[SdfFileFormatTokens->TargetArg] =
Expand Down Expand Up @@ -2952,7 +2951,7 @@ UsdStage::_ComposeSubtreesInParallel(

// Begin a subtree composition in parallel.
WorkWithScopedParallelism([this, &prims, &primIndexPaths]() {
_dispatcher = boost::in_place();
_dispatcher.emplace();
// We populate the clip cache concurrently during composition, so we
// need to enable concurrent population here.
Usd_ClipCache::ConcurrentPopulationContext
Expand Down Expand Up @@ -3104,7 +3103,7 @@ UsdStage::_DestroyPrimsInParallel(const vector<SdfPath>& paths)
TF_AXIOM(!_dispatcher);

WorkWithScopedParallelism([&]() {
_dispatcher = boost::in_place();
_dispatcher.emplace();
for (const auto& path : paths) {
Usd_PrimDataPtr prim = _GetPrimDataAtPath(path);
// We *expect* every prim in paths to be valid as we iterate,
Expand Down