From c9e762e83f6d8d340a816a0d2ecb088a5512248b Mon Sep 17 00:00:00 2001 From: Luc Hermitte <luc.hermitte@c-s.fr> Date: Wed, 9 May 2012 11:43:55 +0200 Subject: [PATCH] COM: OTB-134/OGR -> boost::move and portability --- .../OGRAdapters/otbOGRFeatureWrapper.txx | 12 ++++++++++-- .../OGRAdapters/otbOGRFieldWrapper.txx | 2 +- .../OGRAdapters/otbOGRGeometryWrapper.h | 5 +++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.txx b/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.txx index 524018dcc4..275557f76e 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.txx +++ b/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.txx @@ -22,6 +22,14 @@ /*===============================[ Includes ]================================*/ /*===========================================================================*/ #include <cassert> +#if BOOST_VERSION > 104800 +# include <boost/move/move.hpp> // since 1.48 +#else +# include <boost/interprocess/detail/move.hpp> +namespace boost { +using boost::interprocess::move; +} // boost namespace +#endif /*===========================================================================*/ /*================================[ Feature ]================================*/ @@ -129,7 +137,7 @@ void otb::ogr::Feature::SetGeometryDirectly(UniqueGeometryPtr geometry) { CheckInvariants(); OGRGeometry * g = geometry.get(); - UncheckedSetGeometryDirectly(boost::interprocess::move(geometry)); + UncheckedSetGeometryDirectly(boost::move(geometry)); assert(m_Feature->GetGeometryRef() == g && "The new geometry hasn't been set as expected"); assert(! geometry && "UniqueGeometryPtr hasn't released its pointer"); } @@ -140,7 +148,7 @@ otb::ogr::UniqueGeometryPtr otb::ogr::Feature::StealGeometry() CheckInvariants(); UniqueGeometryPtr res = UncheckedStealGeometry(); assert(! m_Feature->GetGeometryRef() && "Geometry hasn't been properly stolen"); - return boost::interprocess::move(res); + return boost::move(res); } inline diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbOGRFieldWrapper.txx b/Code/UtilitiesAdapters/OGRAdapters/otbOGRFieldWrapper.txx index 5b16a89cd9..a5f4b16853 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbOGRFieldWrapper.txx +++ b/Code/UtilitiesAdapters/OGRAdapters/otbOGRFieldWrapper.txx @@ -264,7 +264,7 @@ typedef map , pair<int_<OFTIntegerList>, MemberContainerSetterPtr<int, &OGRFeature::SetField> > , pair<int_<OFTReal>, MemberSetterPtr<double, &OGRFeature::SetField> > , pair<int_<OFTRealList>, MemberContainerSetterPtr<double, &OGRFeature::SetField> > - // , pair<int_<OFTString>, MemberSetterPtr<char const*, &OGRFeature::SetField/*, std::string*/> > + , pair<int_<OFTString>, MemberSetterPtr<char const*, &OGRFeature::SetField/*, std::string*/> > // , pair<int_<OFTStringList>, MemberContainerSetterPtr<char const*, &OGRFeature::SetField, std::string> > > FieldSetters_Map; diff --git a/Code/UtilitiesAdapters/OGRAdapters/otbOGRGeometryWrapper.h b/Code/UtilitiesAdapters/OGRAdapters/otbOGRGeometryWrapper.h index 6986185a71..8a231b2d4c 100644 --- a/Code/UtilitiesAdapters/OGRAdapters/otbOGRGeometryWrapper.h +++ b/Code/UtilitiesAdapters/OGRAdapters/otbOGRGeometryWrapper.h @@ -79,8 +79,9 @@ struct GeometryDeleter * * \note You may experiment difficulties to copy \c UniqueGeometryPtr. This is * likelly to be normal. You'll have to emulate \c std::move() with \c - * boost::interprocess::move(). Check for instance \c Feature::StealGeometry(), - * or \c Feature::SetGeometryDirectly() to see examples. + * boost::move() (with Boost v1.48+, or with \c boost::interprocess::move() + * otherwise). Check for instance \c Feature::StealGeometry(), or \c + * Feature::SetGeometryDirectly() to see examples. * * \internal * This should be defined on top of C++11 \c std::unique_ptr<>. By the mean -- GitLab