Merge pull request #13567 from ethereum/ranges-filter

Replace use of boost::adapters::filtered with ranges::views::filter
This commit is contained in:
Alex Beregszaszi 2022-09-27 17:34:19 +02:00 committed by GitHub
commit cb5c559392
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 7 additions and 13 deletions

View File

@ -30,7 +30,8 @@
#include <liblangutil/SourceLocation.h>
#include <libsolutil/StringUtils.h>
#include <boost/range/adaptor/filtered.hpp>
#include <range/v3/range/conversion.hpp>
#include <range/v3/view/filter.hpp>
namespace solidity::langutil
{
@ -106,9 +107,8 @@ public:
std::initializer_list<std::string> const descs = { _descriptions... };
solAssert(descs.size() > 0, "Need error descriptions!");
auto filterEmpty = boost::adaptors::filtered([](std::string const& _s) { return !_s.empty(); });
std::string errorStr = util::joinHumanReadable(descs | filterEmpty, " ");
auto nonEmpty = [](std::string const& _s) { return !_s.empty(); };
std::string errorStr = util::joinHumanReadable(descs | ranges::views::filter(nonEmpty) | ranges::to_vector, " ");
error(_error, Error::Type::TypeError, _location, errorStr);
}

View File

@ -26,7 +26,7 @@
#include <libyul/ASTForward.h>
#include <liblangutil/SourceLocation.h>
#include <json/json.h>
#include <boost/variant.hpp>
#include <boost/variant/static_visitor.hpp>
#include <optional>
#include <vector>

View File

@ -31,7 +31,7 @@
#include <libsolutil/CommonData.h>
#include <boost/algorithm/cxx11/all_of.hpp>
#include <range/v3/algorithm/all_of.hpp>
#include <optional>
#include <variant>
@ -64,7 +64,7 @@ void UnusedFunctionParameterPruner::run(OptimiserStepContext& _context, Block& _
{
FunctionDefinition const& f = std::get<FunctionDefinition>(statement);
if (tooSimpleToBePruned(f) || boost::algorithm::all_of(f.parameters + f.returnVariables, used))
if (tooSimpleToBePruned(f) || ranges::all_of(f.parameters + f.returnVariables, used))
continue;
usedParametersAndReturnVariables[f.name] = {

View File

@ -66,7 +66,6 @@
#include <boost/filesystem.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/range/adaptor/filtered.hpp>
#include <boost/algorithm/string.hpp>
#ifdef _WIN32 // windows

View File

@ -43,7 +43,6 @@
#include <string>
#include <sstream>
using namespace ranges;
using namespace std;
using namespace solidity::frontend;
using namespace solidity::langutil;

View File

@ -10,9 +10,7 @@
#include <liblangutil/Exceptions.h>
#include <boost/variant/static_visitor.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/variant.hpp>
#include <ostream>
#include <random>

View File

@ -34,8 +34,6 @@
#include <libsolutil/FixedHash.h>
#include <boost/algorithm/cxx11/all_of.hpp>
#include <range/v3/view/reverse.hpp>
#include <ostream>