From 3f08e8a8ed8d499ee677a275f84d270578884b75 Mon Sep 17 00:00:00 2001
From: Cedric <cedric.traizet@c-s.fr>
Date: Mon, 7 Jan 2019 14:06:52 +0100
Subject: [PATCH] ENH: replaced boost::bind by lambdas

---
 Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx | 2 +-
 Modules/Adapters/GdalAdapters/src/otbOGRFeatureWrapper.cxx    | 4 ++--
 Modules/Adapters/GdalAdapters/src/otbOGRLayerWrapper.cxx      | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx
index 10bcbbcd09..367e0d5389 100644
--- a/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx
+++ b/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx
@@ -108,7 +108,7 @@ char const* DeduceDriverName(std::string filename)
   ExtensionDriverAssociation const* whichIt =
     std::find_if(
       boost::begin(k_ExtensionDriverMap), boost::end(k_ExtensionDriverMap),
-      boost::bind(&ExtensionDriverAssociation::Matches, _1, extension));
+      [&](auto const & x) { return x.Matches(extension); } );
   if (whichIt ==  boost::end(k_ExtensionDriverMap))
     {
     return nullptr; // nothing found
diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRFeatureWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRFeatureWrapper.cxx
index 062bc52ead..20cb96ce87 100644
--- a/Modules/Adapters/GdalAdapters/src/otbOGRFeatureWrapper.cxx
+++ b/Modules/Adapters/GdalAdapters/src/otbOGRFeatureWrapper.cxx
@@ -43,7 +43,7 @@
 otb::ogr::Feature::Feature(OGRFeatureDefn & definition)
 : m_Feature(
   OGRFeature::CreateFeature(&definition),
-  boost::bind(&OGRFeature::DestroyFeature, _1))
+  [&](auto const & x) {return OGRFeature::DestroyFeature(x);})
 {
   CheckInvariants();
 }
@@ -52,7 +52,7 @@ otb::ogr::Feature::Feature(OGRFeature * feature)
 {
   if (feature)
     {
-    m_Feature.reset(feature, boost::bind(&OGRFeature::DestroyFeature, _1));
+    m_Feature.reset(feature, [&](auto const & x) {return OGRFeature::DestroyFeature(x);});
     }
   // else default is perfect -> delete null
 }
diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRLayerWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRLayerWrapper.cxx
index 97d5b7fe13..ff0d528171 100644
--- a/Modules/Adapters/GdalAdapters/src/otbOGRLayerWrapper.cxx
+++ b/Modules/Adapters/GdalAdapters/src/otbOGRLayerWrapper.cxx
@@ -70,7 +70,7 @@ otb::ogr::Layer::Layer(OGRLayer* layer, bool modifiable)
 }
 
 otb::ogr::Layer::Layer(OGRLayer* layer, GDALDataset& sourceInChargeOfLifeTime, bool modifiable)
-:   m_Layer(layer,  boost::bind(&GDALDataset::ReleaseResultSet, boost::ref(sourceInChargeOfLifeTime), _1))
+:   m_Layer(layer, [&](auto const& x) { return sourceInChargeOfLifeTime.ReleaseResultSet(x); })
   , m_Modifiable(modifiable)
 {
   assert(layer && "A null OGRlayer cannot belong to an OGRDataSource" );
-- 
GitLab