Skip to content

Commit

Permalink
Merge pull request #2864 from nvmkuruc/sdfoptional
Browse files Browse the repository at this point in the history
Replace `boost::optional` with `std::optional` in `SdfLayer` and `Sdf_TextParserContext`

(Internal change: 2308968)
  • Loading branch information
pixar-oss committed Dec 15, 2023
2 parents e426f4c + d043347 commit 7e48eab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pxr/usd/sdf/layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ SdfLayer::_WaitForInitializationAndCheckIfSuccessful()
// The callers of this method are responsible for checking the result
// and dropping any references they hold. As a convenience to them,
// we return the value here.
return _initializationWasSuccessful.get();
return _initializationWasSuccessful.value();
}

static bool
Expand Down Expand Up @@ -2954,7 +2954,7 @@ SdfLayer::_ShouldNotify() const
{
// Only notify if this layer has been successfully initialized.
// (If initialization is not yet complete, do not notify.)
return _initializationWasSuccessful.get_value_or(false);
return _initializationWasSuccessful.value_or(false);
}

void
Expand Down
5 changes: 2 additions & 3 deletions pxr/usd/sdf/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@
#include "pxr/base/vt/value.h"
#include "pxr/base/work/dispatcher.h"

#include <boost/optional.hpp>

#include <atomic>
#include <functional>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>
Expand Down Expand Up @@ -1956,7 +1955,7 @@ class SdfLayer

// This is an optional<bool> that is only set once initialization
// is complete, before _initializationComplete is set.
boost::optional<bool> _initializationWasSuccessful;
std::optional<bool> _initializationWasSuccessful;

// remembers the last 'IsDirty' state.
mutable bool _lastDirtyState;
Expand Down
5 changes: 2 additions & 3 deletions pxr/usd/sdf/textParserContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@

#include "pxr/base/tf/token.h"

#include <boost/optional.hpp>

#include <optional>
#include <string>
#include <vector>

Expand Down Expand Up @@ -85,7 +84,7 @@ class Sdf_TextParserContext {
bool relParsingAllowTargetData;
// relationship target paths that will be saved in a list op
// (use a boost::optional to track whether we have seen an opinion at all.)
boost::optional<SdfPathVector> relParsingTargetPaths;
std::optional<SdfPathVector> relParsingTargetPaths;
// relationship target paths that will be appended to the relationship's
// list of target children.
SdfPathVector relParsingNewTargetChildren;
Expand Down

0 comments on commit 7e48eab

Please sign in to comment.