in include/range/v3/algorithm/unique_copy.hpp [46:70]
static tagged_pair<tag::in(I), tag::out(O)> impl(I begin, S end, O out, C pred_, P proj_,
concepts::InputIterator*, std::false_type)
{
auto &&pred = as_function(pred_);
auto &&proj = as_function(proj_);
if(begin != end)
{
// Must save a copy into a local because we will need this value
// even after we advance the input iterator.
iterator_value_t<I> value = *begin; // This is guaranteed by IndirectlyCopyable
*out = value;
++out;
while(++begin != end)
{
auto &&x = *begin;
if(!pred(proj(value), proj(x)))
{
value = (decltype(x) &&) x;
*out = value;
++out;
}
}
}
return {begin, out};
}