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::any with std::any in pxr/base/tf #2684

Merged
merged 2 commits into from
Nov 1, 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
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
16 changes: 14 additions & 2 deletions pxr/base/tf/diagnosticHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,29 @@
#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>

// Follow up changes should more tightly scope these to just where it's needed
// in pxr.
#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN)
// Include <unistd.h> to provide _exit for tf/debugger.cpp and dependencies
// that were previously transitively getting this from boost
#include <unistd.h>
// Include <cstring> to provide memset, memcmp, and memcpy for dependencies
// that were previously transitively getting them from boost
#include <cstring>
#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
1 change: 1 addition & 0 deletions pxr/imaging/hgiMetal/shaderGenerator.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "pxr/imaging/hgiMetal/resourceBindings.h"
#include "pxr/imaging/hgi/tokens.h"

#include <sstream>
#include <unordered_map>

PXR_NAMESPACE_OPEN_SCOPE
Expand Down
Loading