Skip to content

Commit

Permalink
Merge pull request #2711 from nvmkuruc/tfoptional
Browse files Browse the repository at this point in the history
Replace `boost::optional` with `std::optional` in `tf`

(Internal change: 2307839)
  • Loading branch information
pixar-oss committed Dec 7, 2023
2 parents 66fcf72 + 6ca82c9 commit 898270a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pxr/base/tf/scopeDescription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ TfScopeDescription::SetDescription(std::string const &msg)
tbb::spin_mutex::scoped_lock lock(stack.mutex);
_description = msg.c_str();
}
_ownedString = boost::none;
_ownedString = std::nullopt;
}

void
Expand All @@ -399,7 +399,7 @@ TfScopeDescription::SetDescription(char const *msg)
tbb::spin_mutex::scoped_lock lock(stack.mutex);
_description = msg;
}
_ownedString = boost::none;
_ownedString = std::nullopt;
}

static
Expand Down
5 changes: 2 additions & 3 deletions pxr/base/tf/scopeDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
#include "pxr/base/tf/stringUtils.h"
#include "pxr/base/tf/api.h"

#include <boost/optional.hpp>

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

Expand Down Expand Up @@ -109,7 +108,7 @@ class TfScopeDescription
inline void _Push();
inline void _Pop() const;

boost::optional<std::string> _ownedString;
std::optional<std::string> _ownedString;
char const *_description;
TfCallContext _context;
void *_localStack;
Expand Down
7 changes: 3 additions & 4 deletions pxr/base/tf/type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@
#include "pxr/base/tf/pyUtils.h"
#endif // PXR_PYTHON_SUPPORT_ENABLED

#include <boost/optional.hpp>

#include <atomic>
#include <algorithm>
#include <iostream>
#include <map>
#include <memory>
#include <optional>
#include <vector>

#include <thread>
Expand Down Expand Up @@ -128,9 +127,9 @@ struct TfType::_TypeInfo {
std::unique_ptr<TfType::FactoryBase> factory;

// Map of derived type aliases to derived types.
boost::optional<NameToTypeMap> aliasToDerivedTypeMap;
std::optional<NameToTypeMap> aliasToDerivedTypeMap;
// Reverse map of derived types to their aliases.
boost::optional<TypeToNamesMap> derivedTypeToAliasesMap;
std::optional<TypeToNamesMap> derivedTypeToAliasesMap;

// Map of functions for converting to other types.
// This map is keyed by type_info and not TfType because the TfTypes
Expand Down

0 comments on commit 898270a

Please sign in to comment.