Replace boost/algorithm/cxx11 with C++11 features

This commit is contained in:
Alex Beregszaszi 2020-05-11 12:05:39 +01:00
parent 81397dc2c5
commit 875415a132
7 changed files with 17 additions and 14 deletions

View File

@ -27,7 +27,6 @@
#include <liblangutil/ErrorReporter.h> #include <liblangutil/ErrorReporter.h>
#include <liblangutil/SemVerHandler.h> #include <liblangutil/SemVerHandler.h>
#include <boost/algorithm/cxx11/all_of.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <memory> #include <memory>
@ -335,7 +334,11 @@ bool SyntaxChecker::visit(FunctionTypeName const& _node)
bool SyntaxChecker::visit(VariableDeclarationStatement const& _statement) bool SyntaxChecker::visit(VariableDeclarationStatement const& _statement)
{ {
// Report if none of the variable components in the tuple have a name (only possible via deprecated "var") // 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( m_errorReporter.syntaxError(
3299_error, 3299_error,
_statement.location(), _statement.location(),

View File

@ -34,7 +34,6 @@
#include <libsolutil/Algorithms.h> #include <libsolutil/Algorithms.h>
#include <libsolutil/StringUtils.h> #include <libsolutil/StringUtils.h>
#include <boost/algorithm/cxx11/all_of.hpp>
#include <boost/algorithm/string/join.hpp> #include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
@ -1058,7 +1057,11 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
// No initial value is only permitted for single variables with specified type. // No initial value is only permitted for single variables with specified type.
if (_statement.declarations().size() != 1 || !_statement.declarations().front()) 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). // The syntax checker has already generated an error for this case (empty LHS tuple).
solAssert(m_errorReporter.hasErrors(), ""); solAssert(m_errorReporter.hasErrors(), "");

View File

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

View File

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

View File

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

View File

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

View File

@ -29,8 +29,6 @@
#include <libyul/Dialect.h> #include <libyul/Dialect.h>
#include <libyul/SideEffects.h> #include <libyul/SideEffects.h>
#include <boost/algorithm/cxx11/none_of.hpp>
using namespace std; using namespace std;
using namespace solidity; using namespace solidity;
using namespace solidity::yul; 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 // 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 // replace `let a := f()` by `pop(f())` (in pure Yul, this will be
// `drop(f())`). // `drop(f())`).
if (boost::algorithm::none_of( if (std::none_of(
varDecl.variables, varDecl.variables.begin(),
varDecl.variables.end(),
[=](TypedName const& _typedName) { return used(_typedName.name); } [=](TypedName const& _typedName) { return used(_typedName.name); }
)) ))
{ {