Skip to content

Commit 5336d0f

Browse files
luca-schleckerThe-EDev
authored andcommitted
json: replace remaining boost functions with their std equivalent.
1 parent 60ca594 commit 5336d0f

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

include/crow/json.h

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#include <iostream>
1313
#include <algorithm>
1414
#include <memory>
15-
#include <boost/algorithm/string/predicate.hpp>
16-
#include <boost/operators.hpp>
1715
#include <vector>
1816
#include <cmath>
1917

@@ -116,7 +114,7 @@ namespace crow
116114
namespace detail
117115
{
118116
/// A read string implementation with comparison functionality.
119-
struct r_string : boost::less_than_comparable<r_string>, boost::less_than_comparable<r_string, std::string>, boost::equality_comparable<r_string>, boost::equality_comparable<r_string, std::string>
117+
struct r_string
120118
{
121119
r_string(){};
122120
r_string(char* s, char* e):
@@ -189,27 +187,57 @@ namespace crow
189187

190188
inline bool operator<(const r_string& l, const r_string& r)
191189
{
192-
return boost::lexicographical_compare(l, r);
190+
return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end());
193191
}
194192

195193
inline bool operator<(const r_string& l, const std::string& r)
196194
{
197-
return boost::lexicographical_compare(l, r);
195+
return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end());
196+
}
197+
198+
inline bool operator<(const std::string& l, const r_string& r)
199+
{
200+
return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end());
198201
}
199202

200203
inline bool operator>(const r_string& l, const std::string& r)
201204
{
202-
return boost::lexicographical_compare(r, l);
205+
return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end());
206+
}
207+
208+
inline bool operator>(const std::string& l, const r_string& r)
209+
{
210+
return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end());
203211
}
204212

205213
inline bool operator==(const r_string& l, const r_string& r)
206214
{
207-
return boost::equals(l, r);
215+
return std::equal(l.begin(), l.end(), r.begin(), r.end());
208216
}
209217

210218
inline bool operator==(const r_string& l, const std::string& r)
211219
{
212-
return boost::equals(l, r);
220+
return std::equal(l.begin(), l.end(), r.begin(), r.end());
221+
}
222+
223+
inline bool operator==(const std::string& l, const r_string& r)
224+
{
225+
return std::equal(l.begin(), l.end(), r.begin(), r.end());
226+
}
227+
228+
inline bool operator!=(const r_string& l, const r_string& r)
229+
{
230+
return !(l == r);
231+
}
232+
233+
inline bool operator!=(const r_string& l, const std::string& r)
234+
{
235+
return !(l == r);
236+
}
237+
238+
inline bool operator!=(const std::string& l, const r_string& r)
239+
{
240+
return !(l == r);
213241
}
214242
} // namespace detail
215243

0 commit comments

Comments
 (0)