Merge pull request from ethereum/boost-cxx11

Replace boost/algorithm/cxx11 with C++11 features
This commit is contained in:
chriseth 2020-05-11 16:29:42 +02:00 committed by GitHub
commit debee799dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 18 deletions

View File

@ -27,7 +27,6 @@
#include <liblangutil/ErrorReporter.h>
#include <liblangutil/SemVerHandler.h>
#include <boost/algorithm/cxx11/all_of.hpp>
#include <boost/algorithm/string.hpp>
#include <memory>
@ -335,7 +334,11 @@ bool SyntaxChecker::visit(FunctionTypeName const& _node)
bool SyntaxChecker::visit(VariableDeclarationStatement const& _statement)
{
// Report if none of the variable components in the tuple have a name (only possible via deprecated "var")
if (boost::algorithm::all_of_equal(_statement.declarations(), nullptr))
if (std::all_of(
_statement.declarations().begin(),
_statement.declarations().end(),
[](ASTPointer<VariableDeclaration> const& declaration) { return declaration == nullptr; }
))
m_errorReporter.syntaxError(
3299_error,
_statement.location(),

View File

@ -34,7 +34,6 @@
#include <libsolutil/Algorithms.h>
#include <libsolutil/StringUtils.h>
#include <boost/algorithm/cxx11/all_of.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/predicate.hpp>
@ -1069,7 +1068,11 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
// No initial value is only permitted for single variables with specified type.
if (_statement.declarations().size() != 1 || !_statement.declarations().front())
{
if (boost::algorithm::all_of_equal(_statement.declarations(), nullptr))
if (std::all_of(
_statement.declarations().begin(),
_statement.declarations().end(),
[](ASTPointer<VariableDeclaration> const& declaration) { return declaration == nullptr; }
))
{
// The syntax checker has already generated an error for this case (empty LHS tuple).
solAssert(m_errorReporter.hasErrors(), "");

View File

@ -67,7 +67,7 @@
#include <json/json.h>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <utility>
using namespace std;

View File

@ -31,7 +31,6 @@
#include <libsolutil/JSON.h>
#include <libsolutil/Keccak256.h>
#include <boost/algorithm/cxx11/any_of.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <algorithm>

View File

@ -38,9 +38,6 @@ using namespace solidity;
using namespace solidity::yul;
using namespace solidity::util;
using boost::split;
using boost::is_any_of;
string solidity::yul::reindent(string const& _code)
{
int constexpr indentationWidth = 4;
@ -55,7 +52,7 @@ string solidity::yul::reindent(string const& _code)
};
vector<string> lines;
split(lines, _code, is_any_of("\n"));
boost::split(lines, _code, boost::is_any_of("\n"));
for (string& line: lines)
boost::trim(line);

View File

@ -25,7 +25,6 @@
#include <libsolutil/Visitor.h>
#include <boost/range/algorithm_ext/erase.hpp>
#include <boost/algorithm/cxx11/any_of.hpp>
using namespace std;
using namespace solidity;
@ -60,8 +59,9 @@ void removeEmptyDefaultFromSwitch(Switch& _switchStmt)
void removeEmptyCasesFromSwitch(Switch& _switchStmt)
{
bool hasDefault = boost::algorithm::any_of(
_switchStmt.cases,
bool hasDefault = std::any_of(
_switchStmt.cases.begin(),
_switchStmt.cases.end(),
[](Case const& _case) { return !_case.value; }
);

View File

@ -22,7 +22,6 @@
#include <libsolutil/Visitor.h>
#include <boost/range/algorithm_ext/erase.hpp>
#include <boost/algorithm/cxx11/any_of.hpp>
using namespace std;
using namespace solidity;

View File

@ -29,8 +29,6 @@
#include <libyul/Dialect.h>
#include <libyul/SideEffects.h>
#include <boost/algorithm/cxx11/none_of.hpp>
using namespace std;
using namespace solidity;
using namespace solidity::yul;
@ -85,8 +83,9 @@ void UnusedPruner::operator()(Block& _block)
// movable or it returns a single value. In the latter case, we
// replace `let a := f()` by `pop(f())` (in pure Yul, this will be
// `drop(f())`).
if (boost::algorithm::none_of(
varDecl.variables,
if (std::none_of(
varDecl.variables.begin(),
varDecl.variables.end(),
[=](TypedName const& _typedName) { return used(_typedName.name); }
))
{