From fdc1f54935e6131e8e019860b6c58baab32bebd5 Mon Sep 17 00:00:00 2001 From: Matt Kuruc Date: Tue, 5 Sep 2023 21:10:10 -0700 Subject: [PATCH] Replace `boost::variant` with `std::variant` in `pxr/base/trace` --- pxr/base/trace/eventData.cpp | 22 +++++++++++----------- pxr/base/trace/eventData.h | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pxr/base/trace/eventData.cpp b/pxr/base/trace/eventData.cpp index 6977a89f5e..f92b916f78 100644 --- a/pxr/base/trace/eventData.cpp +++ b/pxr/base/trace/eventData.cpp @@ -31,8 +31,8 @@ PXR_NAMESPACE_OPEN_SCOPE namespace { -// Boost variant visitor to convert TraceEventData to JsValue -class JsValue_visitor : public boost::static_visitor +// Variant visitor to convert TraceEventData to JsValue +class JsValue_visitor { public: JsValue_visitor(JsWriter& writer) @@ -67,8 +67,8 @@ class JsValue_visitor : public boost::static_visitor JsWriter& _writer; }; -// Boost variant visitor to convert TraceEventData to TraceEvent::DataType -class Type_visitor : public boost::static_visitor +// Variant visitor to convert TraceEventData to TraceEvent::DataType +class Type_visitor { public: TraceEvent::DataType operator()(int64_t i) const { @@ -101,42 +101,42 @@ class Type_visitor : public boost::static_visitor TraceEvent::DataType TraceEventData::GetType() const { - return boost::apply_visitor(Type_visitor(), _data); + return std::visit(Type_visitor(), _data); } const int64_t* TraceEventData::GetInt() const { return GetType() == TraceEvent::DataType::Int ? - &boost::get(_data) : nullptr; + &std::get(_data) : nullptr; } const uint64_t* TraceEventData::GetUInt() const { return GetType() == TraceEvent::DataType::UInt ? - &boost::get(_data) : nullptr; + &std::get(_data) : nullptr; } const double* TraceEventData::GetFloat() const { return GetType() == TraceEvent::DataType::Float ? - &boost::get(_data) : nullptr; + &std::get(_data) : nullptr; } const bool* TraceEventData::GetBool() const { return GetType() == TraceEvent::DataType::Boolean ? - &boost::get(_data) : nullptr; + &std::get(_data) : nullptr; } const std::string* TraceEventData::GetString() const { return GetType() == TraceEvent::DataType::String ? - &boost::get(_data) : nullptr; + &std::get(_data) : nullptr; } void TraceEventData::WriteJson(JsWriter& writer) const { - boost::apply_visitor(JsValue_visitor(writer), _data); + std::visit(JsValue_visitor(writer), _data); } PXR_NAMESPACE_CLOSE_SCOPE \ No newline at end of file diff --git a/pxr/base/trace/eventData.h b/pxr/base/trace/eventData.h index 3abddfe9b2..82a69b2e3a 100644 --- a/pxr/base/trace/eventData.h +++ b/pxr/base/trace/eventData.h @@ -30,8 +30,8 @@ #include "pxr/base/trace/api.h" #include "pxr/base/trace/event.h" -#include #include +#include PXR_NAMESPACE_OPEN_SCOPE @@ -88,7 +88,7 @@ class TraceEventData { struct _NoData {}; using Variant = - boost::variant<_NoData, std::string, bool, int64_t, uint64_t, double>; + std::variant<_NoData, std::string, bool, int64_t, uint64_t, double>; Variant _data; };