trim: avoid the soon-to-be-deprecated std::ptr_fun
Reported by Etienne Renault. * spot/priv/trim.cc: Simplify with a lambda.
This commit is contained in:
parent
64e3fcfb54
commit
70b72b87ce
1 changed files with 4 additions and 8 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
// -*- coding: utf-8 -*-
|
// -*- 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).
|
// de l'Epita (LRDE).
|
||||||
//
|
//
|
||||||
// This file is part of Spot, a model checking library.
|
// This file is part of Spot, a model checking library.
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <spot/priv/trim.hh>
|
#include <spot/priv/trim.hh>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
|
||||||
|
|
@ -29,12 +28,9 @@ namespace spot
|
||||||
void
|
void
|
||||||
trim(std::string& str)
|
trim(std::string& str)
|
||||||
{
|
{
|
||||||
str.erase(std::find_if(str.rbegin(), str.rend(),
|
auto not_space = [](unsigned char c){ return !std::isspace(c); };
|
||||||
std::not1(std::ptr_fun<int, int>
|
str.erase(std::find_if(str.rbegin(), str.rend(), not_space).base(),
|
||||||
(std::isspace))).base(),
|
|
||||||
str.end());
|
str.end());
|
||||||
str.erase(str.begin(),
|
str.erase(str.begin(), std::find_if(str.begin(), str.end(), not_space));
|
||||||
std::find_if(str.begin(), str.end(),
|
|
||||||
std::not1(std::ptr_fun<int, int>(std::isspace))));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue