Using range-v3 instead of boost

Signed-off-by: soroosh-sdi <soroosh.sardari@gmail.com>
This commit is contained in:
soroosh-sdi 2021-08-24 21:38:18 +04:30
parent 7a0295ec6c
commit b0ce98bcb2
6 changed files with 15 additions and 18 deletions

View File

@ -20,7 +20,8 @@
#include <liblangutil/SourceLocation.h> #include <liblangutil/SourceLocation.h>
#include <libsolutil/Algorithms.h> #include <libsolutil/Algorithms.h>
#include <boost/range/algorithm/sort.hpp>
#include <range/v3/algorithm/sort.hpp>
#include <functional> #include <functional>
@ -141,7 +142,7 @@ void ControlFlowAnalyzer::checkUninitializedAccess(CFGNode const* _entry, CFGNod
exitInfo.uninitializedVariableAccesses.begin(), exitInfo.uninitializedVariableAccesses.begin(),
exitInfo.uninitializedVariableAccesses.end() exitInfo.uninitializedVariableAccesses.end()
); );
boost::range::sort( ranges::sort(
uninitializedAccessesOrdered, uninitializedAccessesOrdered,
[](VariableOccurrence const* lhs, VariableOccurrence const* rhs) -> bool [](VariableOccurrence const* lhs, VariableOccurrence const* rhs) -> bool
{ {

View File

@ -38,7 +38,6 @@
#include <boost/algorithm/string/join.hpp> #include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <range/v3/view/zip.hpp> #include <range/v3/view/zip.hpp>
#include <range/v3/view/drop_exactly.hpp> #include <range/v3/view/drop_exactly.hpp>

View File

@ -34,7 +34,8 @@
#include <libsolutil/UTF8.h> #include <libsolutil/UTF8.h>
#include <boost/algorithm/string/join.hpp> #include <boost/algorithm/string/join.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <range/v3/algorithm/sort.hpp>
#include <utility> #include <utility>
#include <vector> #include <vector>
@ -563,8 +564,9 @@ bool ASTJsonConverter::visit(InlineAssembly const& _node)
Json::Value externalReferencesJson = Json::arrayValue; Json::Value externalReferencesJson = Json::arrayValue;
for (auto&& it: boost::range::sort(externalReferences)) ranges::sort(externalReferences);
externalReferencesJson.append(std::move(it.second)); for (Json::Value& it: externalReferences | ranges::views::values)
externalReferencesJson.append(std::move(it));
setJsonNode(_node, "InlineAssembly", { setJsonNode(_node, "InlineAssembly", {
make_pair("AST", Json::Value(yul::AsmJsonConverter(sourceIndexFromLocation(_node.location()))(_node.operations()))), make_pair("AST", Json::Value(yul::AsmJsonConverter(sourceIndexFromLocation(_node.location()))(_node.operations()))),

View File

@ -34,8 +34,6 @@
#include <range/v3/view.hpp> #include <range/v3/view.hpp>
#include <boost/range/adaptors.hpp>
#include <deque> #include <deque>

View File

@ -24,8 +24,9 @@
#include <liblangutil/ErrorReporter.h> #include <liblangutil/ErrorReporter.h>
#include <liblangutil/Exceptions.h> #include <liblangutil/Exceptions.h>
#include <boost/range/algorithm/find_first_of.hpp> #include <range/v3/algorithm/find_first_of.hpp>
#include <boost/range/irange.hpp> #include <range/v3/algorithm/find_if_not.hpp>
#include <range/v3/view/subrange.hpp>
using namespace std; using namespace std;
using namespace solidity; using namespace solidity;
@ -52,8 +53,7 @@ string::const_iterator firstNonIdentifier(
if (currPos == _pos && isIdentifierStart(*currPos)) if (currPos == _pos && isIdentifierStart(*currPos))
{ {
currPos++; currPos++;
while (currPos != _end && isIdentifierPart(*currPos)) currPos = ranges::find_if_not(ranges::make_subrange(currPos, _end), isIdentifierPart);
currPos++;
} }
return currPos; return currPos;
} }
@ -63,7 +63,7 @@ string::const_iterator firstWhitespaceOrNewline(
string::const_iterator _end string::const_iterator _end
) )
{ {
return boost::range::find_first_of(make_pair(_pos, _end), " \t\n"); return ranges::find_first_of(ranges::make_subrange(_pos, _end), " \t\n");
} }
@ -72,10 +72,8 @@ string::const_iterator skipWhitespace(
string::const_iterator _end string::const_iterator _end
) )
{ {
auto currPos = _pos; auto isWhitespace = [](char const& c) { return (c == ' ' || c == '\t'); };
while (currPos != _end && (*currPos == ' ' || *currPos == '\t')) return ranges::find_if_not(ranges::make_subrange(_pos, _end), isWhitespace);
currPos += 1;
return currPos;
} }
} }

View File

@ -32,7 +32,6 @@
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/algorithm/string/join.hpp> #include <boost/algorithm/string/join.hpp>
using namespace std; using namespace std;