Commit 3f2d0cb8 authored by Laurențiu Nicola's avatar Laurențiu Nicola

Merge branch 'std-foreach' into 'develop'

ENH: Replace Boost.Foreach with standard C++ for

See merge request !791
parents e76c2d50 44d9f7e8
Pipeline #6862 passed with stages
in 19 minutes and 44 seconds
......@@ -24,11 +24,9 @@
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <boost/foreach.hpp>
#include <boost/tokenizer.hpp>
#pragma GCC diagnostic pop
#else
#include <boost/foreach.hpp>
#include <boost/tokenizer.hpp>
#endif
......
......@@ -567,16 +567,6 @@ private:
}
} // end namespace otb::ogr
#if 0
// Either this, or inheriting from noncopyable is required for DataSource to be
// compatible with BOOST_FOREACH
namespace boost { namespace foreach {
template<typename T> struct is_noncopyable; // forward declaration
template <>
struct is_noncopyable<otb::ogr::DataSource> : mpl::true_ {};
}}
#endif
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbOGRDataSourceWrapper.hxx"
#endif
......
......@@ -25,10 +25,6 @@
#include <numeric>
#include <algorithm>
#include <clocale> // toupper
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
// ITK includes
#include "itkMacro.h" // itkExceptionMacro
#include "itkExceptionObject.h"
......@@ -99,8 +95,8 @@ char const* DeduceDriverName(std::string filename)
}
const std::string extension = itksys::SystemTools::GetFilenameLastExtension(filename);
ExtensionDriverAssociation const* whichIt =
std::find_if(boost::begin(k_ExtensionDriverMap), boost::end(k_ExtensionDriverMap), [&](auto const& x) { return x.Matches(extension); });
if (whichIt == boost::end(k_ExtensionDriverMap))
std::find_if(std::begin(k_ExtensionDriverMap), std::end(k_ExtensionDriverMap), [&](auto const& x) { return x.Matches(extension); });
if (whichIt == std::end(k_ExtensionDriverMap))
{
return nullptr; // nothing found
}
......@@ -692,7 +688,7 @@ std::string otb::ogr::DataSource::GetGlobalExtent(double& ulx, double& uly, doub
void otb::ogr::DataSource::PrintSelf(std::ostream& os, itk::Indent indent) const
{
assert(m_DataSource && "Datasource not initialized");
BOOST_FOREACH (Layer const& l, *this)
for (const Layer &l : *this)
{
l.PrintSelf(os, indent);
}
......
......@@ -23,8 +23,6 @@
/*===============================[ Includes ]================================*/
/*===========================================================================*/
#include "otbOGRFeatureWrapper.h"
#include <boost/bind.hpp>
#include <boost/make_shared.hpp>
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
......
......@@ -24,8 +24,6 @@
/*===========================================================================*/
#include <cassert>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
......@@ -223,7 +221,7 @@ void otb::ogr::Layer::PrintSelf(std::ostream& os, itk::Indent indent) const
{
os << "Layer <" << GetName() << "> of " << OGRGeometryTypeToName(GetGeomType()) << "\n";
indent = indent.GetNextIndent();
BOOST_FOREACH (Feature f, *this)
for (Feature f : *this)
{
f.PrintSelf(os, indent);
}
......
......@@ -33,7 +33,6 @@
#else
#include <boost/test/unit_test.hpp>
#endif
#include <boost/foreach.hpp>
#include "otb_boost_string_header.h"
#include "itksys/SystemTools.hxx"
#include "otbOGRDataSourceWrapper.h"
......@@ -821,7 +820,7 @@ BOOST_AUTO_TEST_CASE(Add_n_Read_Geometries)
BOOST_CHECK_EQUAL(l.GetFeatureCount(false), 20);
int u = -10;
BOOST_FOREACH (ogr::Feature f, l)
for (ogr::Feature f : l)
{
const OGRPoint ref(u, u);
ogr::UniqueGeometryPtr p = f.StealGeometry();
......
......@@ -24,7 +24,6 @@
#include "otbPersistentImageToOGRDataFilter.h"
#include "otbStopwatch.h"
#include <boost/foreach.hpp>
#include <stdio.h>
#include "otbMacro.h"
#include "otbOGRHelpers.h"
......
......@@ -24,7 +24,6 @@
#include "otbPersistentImageToOGRLayerFilter.h"
#include "otbStopwatch.h"
#include <boost/foreach.hpp>
#include <stdio.h>
#include "otbMacro.h"
#include "otbOGRHelpers.h"
......@@ -91,10 +90,10 @@ void PersistentImageToOGRLayerFilter<TImage>::Initialize()
oSRSESRI.morphFromESRI();
#if GDAL_VERSION_NUM >= 3000000 // importFromWkt is const-correct in GDAL 3
// Use the same mapping strategy as the one in the datasource.
auto mappingStrategy = m_OGRLayer.GetSpatialRef()->GetAxisMappingStrategy();
oSRS.SetAxisMappingStrategy(mappingStrategy);
oSRSESRI.SetAxisMappingStrategy(mappingStrategy);
// Use the same mapping strategy as the one in the datasource.
auto mappingStrategy = m_OGRLayer.GetSpatialRef()->GetAxisMappingStrategy();
oSRS.SetAxisMappingStrategy(mappingStrategy);
oSRSESRI.SetAxisMappingStrategy(mappingStrategy);
#endif
if (m_OGRLayer.GetSpatialRef() && (!oSRS.IsSame(m_OGRLayer.GetSpatialRef()) && !oSRSESRI.IsSame(m_OGRLayer.GetSpatialRef())))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment