Skip to content

Commit

Permalink
Replace boost::any with std::any in pxr/base/tf
Browse files Browse the repository at this point in the history
  • Loading branch information
nvmkuruc committed Sep 19, 2023
1 parent 151f82e commit fb689e1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pxr/base/tf/diagnosticBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
#include "pxr/base/arch/attributes.h"
#include "pxr/base/arch/function.h"

#include <boost/any.hpp>
#include <any>
#include <cstdarg>
#include <string>

PXR_NAMESPACE_OPEN_SCOPE

typedef boost::any TfDiagnosticInfo;
typedef std::any TfDiagnosticInfo;

class TfDiagnosticMgr;

Expand Down Expand Up @@ -160,7 +160,7 @@ class TfDiagnosticBase {
/// then GetInfo() returns NULL.
template <typename T>
const T* GetInfo() const {
return boost::any_cast<T>(&_info);
return std::any_cast<T>(&_info);
}

/// Set the info object associated with this diagnostic message.
Expand Down
12 changes: 10 additions & 2 deletions pxr/base/tf/diagnosticHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,25 @@
#include "pxr/pxr.h"
#include "pxr/base/tf/api.h"
#include "pxr/base/arch/attributes.h"
#include "pxr/base/arch/defines.h"

// XXX: This include is a hack to avoid build errors due to
// incompatible macro definitions in pyport.h on macOS.
#include <locale>

#include <boost/any.hpp>
#include <any>
#include <string>

#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN)
// Include <unistd.h> to provide _exit for tf/debugger.cpp and dependencies
// that were previously transiently getting this from boost. Follow up changes
// should more tightly scope this to just where it's needed in pxr.
#include <unistd.h>
#endif

PXR_NAMESPACE_OPEN_SCOPE

typedef boost::any TfDiagnosticInfo;
typedef std::any TfDiagnosticInfo;
class TfCallContext;
enum TfDiagnosticType : int;
class TfEnum;
Expand Down
5 changes: 2 additions & 3 deletions pxr/base/tf/diagnosticMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@
#include "pxr/base/arch/stackTrace.h"
#include "pxr/base/arch/threads.h"

#include <boost/utility.hpp>

#include <signal.h>
#include <stdlib.h>

#include <any>
#include <thread>
#include <memory>

Expand Down Expand Up @@ -673,7 +672,7 @@ TfDiagnosticMgr::FormatDiagnostic(const TfEnum &code,

#ifdef PXR_PYTHON_SUPPORT_ENABLED
if (const TfPyExceptionState* exc =
boost::any_cast<TfPyExceptionState>(&info)) {
std::any_cast<TfPyExceptionState>(&info)) {
output += TfStringPrintf("%s\n", exc->GetExceptionString().c_str());
}
#endif // PXR_PYTHON_SUPPORT_ENABLED
Expand Down

0 comments on commit fb689e1

Please sign in to comment.