diff --git a/include/GafferSceneUI/Private/Inspector.h b/include/GafferSceneUI/Private/Inspector.h index 04f4e9c2243..ea4ac85cdc6 100644 --- a/include/GafferSceneUI/Private/Inspector.h +++ b/include/GafferSceneUI/Private/Inspector.h @@ -51,10 +51,10 @@ #include "boost/multi_index/member.hpp" #include "boost/multi_index/random_access_index.hpp" #include "boost/multi_index_container.hpp" -#include "boost/variant.hpp" #include #include +#include namespace GafferSceneUIModule { @@ -171,7 +171,7 @@ class GAFFERSCENEUI_API Inspector : public IECore::RefCounted, public Gaffer::Si virtual Gaffer::ValuePlugPtr source( const GafferScene::SceneAlgo::History *history, std::string &editWarning ) const; using EditFunction = std::function; - using EditFunctionOrFailure = boost::variant; + using EditFunctionOrFailure = std::variant; /// Should be implemented to return a function that will acquire /// an edit from the EditScope at the specified point in the history. /// If this is not possible, should return an error explaining why @@ -184,7 +184,7 @@ class GAFFERSCENEUI_API Inspector : public IECore::RefCounted, public Gaffer::Si virtual EditFunctionOrFailure editFunction( Gaffer::EditScope *editScope, const GafferScene::SceneAlgo::History *history ) const; using DisableEditFunction = std::function; - using DisableEditFunctionOrFailure = boost::variant; + using DisableEditFunctionOrFailure = std::variant; /// Can be implemented to return a function that will disable an edit /// at the specified plug. If this is not possible, should return an /// error explaining why (this is typically due to `readOnly` metadata). diff --git a/src/GafferSceneUI/Inspector.cpp b/src/GafferSceneUI/Inspector.cpp index 710eeea455a..571313d3f77 100644 --- a/src/GafferSceneUI/Inspector.cpp +++ b/src/GafferSceneUI/Inspector.cpp @@ -732,14 +732,15 @@ const std::string &Inspector::Result::fallbackDescription() const bool Inspector::Result::editable() const { - return m_editFunction.which() == 0 && boost::get( m_editFunction ) != nullptr; + auto f = std::get_if( &m_editFunction ); + return f && *f; } std::string Inspector::Result::nonEditableReason() const { - if( m_editFunction.which() == 1 ) + if( auto s = std::get_if( &m_editFunction ) ) { - return boost::get( m_editFunction ); + return *s; } return ""; @@ -747,24 +748,25 @@ std::string Inspector::Result::nonEditableReason() const Gaffer::ValuePlugPtr Inspector::Result::acquireEdit( bool createIfNecessary ) const { - if( m_editFunction.which() == 0 ) + if( auto f = std::get_if( &m_editFunction ) ) { - return boost::get( m_editFunction )( createIfNecessary ); + return (*f)( createIfNecessary ); } - throw IECore::Exception( "Not editable : " + boost::get( m_editFunction ) ); + throw IECore::Exception( "Not editable : " + std::get( m_editFunction ) ); } bool Inspector::Result::canDisableEdit() const { - return m_disableEditFunction.which() == 0 && boost::get( m_disableEditFunction ) != nullptr; + auto f = std::get_if( &m_disableEditFunction ); + return f && *f; } std::string Inspector::Result::nonDisableableReason() const { - if( m_disableEditFunction.which() == 1 ) + if( auto s = std::get_if( &m_disableEditFunction ) ) { - return boost::get( m_disableEditFunction ); + return *s; } return ""; @@ -772,12 +774,12 @@ std::string Inspector::Result::nonDisableableReason() const void Inspector::Result::disableEdit() const { - if( m_disableEditFunction.which() == 0 ) + if( auto f = std::get_if( &m_disableEditFunction ) ) { - return boost::get( m_disableEditFunction )(); + return (*f)(); } - throw IECore::Exception( "Cannot disable edit : " + boost::get( m_disableEditFunction ) ); + throw IECore::Exception( "Cannot disable edit : " + std::get( m_disableEditFunction ) ); } std::string Inspector::Result::editWarning() const