Skip to content

Commit b0ce98b

Browse files
committed
Using range-v3 instead of boost
Signed-off-by: soroosh-sdi <[email protected]>
1 parent 7a0295e commit b0ce98b

File tree

6 files changed

+15
-18
lines changed

6 files changed

+15
-18
lines changed

libsolidity/analysis/ControlFlowAnalyzer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
#include <liblangutil/SourceLocation.h>
2222
#include <libsolutil/Algorithms.h>
23-
#include <boost/range/algorithm/sort.hpp>
23+
24+
#include <range/v3/algorithm/sort.hpp>
2425

2526
#include <functional>
2627

@@ -141,7 +142,7 @@ void ControlFlowAnalyzer::checkUninitializedAccess(CFGNode const* _entry, CFGNod
141142
exitInfo.uninitializedVariableAccesses.begin(),
142143
exitInfo.uninitializedVariableAccesses.end()
143144
);
144-
boost::range::sort(
145+
ranges::sort(
145146
uninitializedAccessesOrdered,
146147
[](VariableOccurrence const* lhs, VariableOccurrence const* rhs) -> bool
147148
{

libsolidity/analysis/TypeChecker.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838

3939
#include <boost/algorithm/string/join.hpp>
4040
#include <boost/algorithm/string/predicate.hpp>
41-
#include <boost/range/adaptor/reversed.hpp>
4241

4342
#include <range/v3/view/zip.hpp>
4443
#include <range/v3/view/drop_exactly.hpp>

libsolidity/ast/ASTJsonConverter.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
#include <libsolutil/UTF8.h>
3535

3636
#include <boost/algorithm/string/join.hpp>
37-
#include <boost/range/algorithm/sort.hpp>
37+
38+
#include <range/v3/algorithm/sort.hpp>
3839

3940
#include <utility>
4041
#include <vector>
@@ -563,8 +564,9 @@ bool ASTJsonConverter::visit(InlineAssembly const& _node)
563564

564565
Json::Value externalReferencesJson = Json::arrayValue;
565566

566-
for (auto&& it: boost::range::sort(externalReferences))
567-
externalReferencesJson.append(std::move(it.second));
567+
ranges::sort(externalReferences);
568+
for (Json::Value& it: externalReferences | ranges::views::values)
569+
externalReferencesJson.append(std::move(it));
568570

569571
setJsonNode(_node, "InlineAssembly", {
570572
make_pair("AST", Json::Value(yul::AsmJsonConverter(sourceIndexFromLocation(_node.location()))(_node.operations()))),

libsolidity/formal/SMTEncoder.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434

3535
#include <range/v3/view.hpp>
3636

37-
#include <boost/range/adaptors.hpp>
38-
3937

4038
#include <deque>
4139

libsolidity/parsing/DocStringParser.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
#include <liblangutil/ErrorReporter.h>
2525
#include <liblangutil/Exceptions.h>
2626

27-
#include <boost/range/algorithm/find_first_of.hpp>
28-
#include <boost/range/irange.hpp>
27+
#include <range/v3/algorithm/find_first_of.hpp>
28+
#include <range/v3/algorithm/find_if_not.hpp>
29+
#include <range/v3/view/subrange.hpp>
2930

3031
using namespace std;
3132
using namespace solidity;
@@ -52,8 +53,7 @@ string::const_iterator firstNonIdentifier(
5253
if (currPos == _pos && isIdentifierStart(*currPos))
5354
{
5455
currPos++;
55-
while (currPos != _end && isIdentifierPart(*currPos))
56-
currPos++;
56+
currPos = ranges::find_if_not(ranges::make_subrange(currPos, _end), isIdentifierPart);
5757
}
5858
return currPos;
5959
}
@@ -63,7 +63,7 @@ string::const_iterator firstWhitespaceOrNewline(
6363
string::const_iterator _end
6464
)
6565
{
66-
return boost::range::find_first_of(make_pair(_pos, _end), " \t\n");
66+
return ranges::find_first_of(ranges::make_subrange(_pos, _end), " \t\n");
6767
}
6868

6969

@@ -72,10 +72,8 @@ string::const_iterator skipWhitespace(
7272
string::const_iterator _end
7373
)
7474
{
75-
auto currPos = _pos;
76-
while (currPos != _end && (*currPos == ' ' || *currPos == '\t'))
77-
currPos += 1;
78-
return currPos;
75+
auto isWhitespace = [](char const& c) { return (c == ' ' || c == '\t'); };
76+
return ranges::find_if_not(ranges::make_subrange(_pos, _end), isWhitespace);
7977
}
8078

8179
}

test/libyul/Inliner.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
#include <boost/test/unit_test.hpp>
3434

35-
#include <boost/range/adaptors.hpp>
3635
#include <boost/algorithm/string/join.hpp>
3736

3837
using namespace std;

0 commit comments

Comments
 (0)