Skip to content

Commit 97275e2

Browse files
committed
pass end iterator by const-ref
1 parent d10ef35 commit 97275e2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

include/boost/parser/detail/text/algorithm.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace boost::parser::detail { namespace text {
2121

2222
namespace detail {
2323
template<typename Iter>
24-
std::ptrdiff_t distance(Iter first, Iter const & last, non_sentinel_tag)
24+
std::ptrdiff_t distance(Iter const & first, Iter const & last, non_sentinel_tag)
2525
{
2626
return std::distance(first, last);
2727
}
@@ -41,7 +41,7 @@ namespace boost::parser::detail { namespace text {
4141
/** Range-friendly version of `std::distance()`, taking an iterator and a
4242
sentinel. */
4343
template<typename Iter, typename Sentinel>
44-
std::ptrdiff_t distance(Iter first, Sentinel const & last)
44+
std::ptrdiff_t distance(Iter const & first, Sentinel const & last)
4545
{
4646
return detail::distance(
4747
first,
@@ -107,7 +107,7 @@ namespace boost::parser::detail { namespace text {
107107
/** Analogue of `std::find()` that finds the last value in `[first, last)`
108108
equal to `x`. */
109109
template<typename BidiIter, typename T>
110-
BidiIter find_backward(BidiIter first, BidiIter last, T const & x)
110+
BidiIter find_backward(BidiIter const & first, BidiIter const & last, T const & x)
111111
{
112112
auto it = last;
113113
while (it != first) {
@@ -120,7 +120,7 @@ namespace boost::parser::detail { namespace text {
120120
/** Analogue of `std::find()` that finds the last value in `[first, last)`
121121
not equal to `x`. */
122122
template<typename BidiIter, typename T>
123-
BidiIter find_not_backward(BidiIter first, BidiIter last, T const & x)
123+
BidiIter find_not_backward(BidiIter const & first, BidiIter const & last, T const & x)
124124
{
125125
auto it = last;
126126
while (it != first) {
@@ -133,7 +133,7 @@ namespace boost::parser::detail { namespace text {
133133
/** Analogue of `std::find()` that finds the last value `v` in `[first,
134134
last)` for which `p(v)` is true. */
135135
template<typename BidiIter, typename Pred>
136-
BidiIter find_if_backward(BidiIter first, BidiIter last, Pred p)
136+
BidiIter find_if_backward(BidiIter const & first, BidiIter const & last, Pred p)
137137
{
138138
auto it = last;
139139
while (it != first) {
@@ -146,7 +146,7 @@ namespace boost::parser::detail { namespace text {
146146
/** Analogue of `std::find()` that finds the last value `v` in `[first,
147147
last)` for which `p(v)` is false. */
148148
template<typename BidiIter, typename Pred>
149-
BidiIter find_if_not_backward(BidiIter first, BidiIter last, Pred p)
149+
BidiIter find_if_not_backward(BidiIter const & first, BidiIter const & last, Pred p)
150150
{
151151
auto it = last;
152152
while (it != first) {
@@ -290,9 +290,9 @@ namespace boost::parser::detail { namespace text {
290290
typename Iter2,
291291
typename Sentinel2>
292292
int lexicographical_compare_three_way(
293-
Iter1 first1,
293+
Iter1 const & first1,
294294
Sentinel1 const & last1,
295-
Iter2 first2,
295+
Iter2 const & first2,
296296
Sentinel2 const & last2)
297297
{
298298
auto const iters = boost::parser::detail::text::mismatch(first1, last1, first2, last2);

0 commit comments

Comments
 (0)