Merge pull request #11837 from soroosh-sdi/use-range-v3-part2

Using range-v3 instead of boost
This commit is contained in:
Leonardo 2021-08-26 09:38:27 +02:00 committed by GitHub
commit 6e6bbb2f83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 18 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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