From 70b72b87ce8f7c31e4d084fb3cc3aba43b678e12 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 17 Oct 2019 11:51:37 +0200 Subject: [PATCH] trim: avoid the soon-to-be-deprecated std::ptr_fun Reported by Etienne Renault. * spot/priv/trim.cc: Simplify with a lambda. --- spot/priv/trim.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/spot/priv/trim.cc b/spot/priv/trim.cc index ad8dbbf64..a5f6c9c50 100644 --- a/spot/priv/trim.cc +++ b/spot/priv/trim.cc @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2015, 2018 Laboratoire de Recherche et Developpement +// Copyright (C) 2015, 2018, 2019 Laboratoire de Recherche et Developpement // de l'Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -20,7 +20,6 @@ #include "config.h" #include #include -#include #include #include @@ -29,12 +28,9 @@ namespace spot void trim(std::string& str) { - str.erase(std::find_if(str.rbegin(), str.rend(), - std::not1(std::ptr_fun - (std::isspace))).base(), + auto not_space = [](unsigned char c){ return !std::isspace(c); }; + str.erase(std::find_if(str.rbegin(), str.rend(), not_space).base(), str.end()); - str.erase(str.begin(), - std::find_if(str.begin(), str.end(), - std::not1(std::ptr_fun(std::isspace)))); + str.erase(str.begin(), std::find_if(str.begin(), str.end(), not_space)); } }