8 #include <unordered_set> 20 template <
class T,
class U>
42 using mapper_type = std::function<key_type(const value_type&)>;
53 bool condition =
true;
56 const auto& alt = this->
parent()->next().value();
60 const auto& value = *alt;
61 auto id = this->
key(value);
62 condition = !this->
tagged.count(
id);
67 return payload_type::withValue(value);
71 return payload_type::withoutValue();
93 template <
class T,
class U>
120 class Fn = decltype(
META::as_fn(std::declval<F>())),
121 class T = META::decay_t<META::arg_t<Fn, 0>>,
122 class U = META::decay_t<META::return_t<Fn>>
135 template <
class T,
class U>
147 template <
class T,
class U>
151 make::ptr<details::UniqueByOperator<T, U>>(lhs.
it(), rhs.
mapper)
Abstract base class for stream iterators defining the required behavior.
typename iterator_type::parent_iterator_type parent_iterator_type
parent_type parent() const
Getter for the parent iterator.
Iterator powering an intermediate operation.
typename parent_iterator_type::payload_type parent_payload_type
StreamIteratorPayload< T > payload_type
Type alias for the payload used.
typename payload_type::value_type value_type
Type alias for the data type manipulated.
bool hasNext() const override
Global namespace of the SCL.
it_t it() const
Get a reference to the underlying iterator.
details::uniqueBy_toolbox< T, U > uniqueBy(F &&mapper)
Remove duplicates from a stream.
details::uniqueBy_toolbox< T, U > uniqueBy_(typename details::uniqueBy_toolbox< T, U >::map_t mapper)
Remove duplicates from a stream by explicitly providing the type arguments.
std::function< key_type(const value_type &)> mapper_type
The function type that computes a key from a value.
std::unordered_set< key_type > tagged
the state that keeps track of all encountered keys
mapper_type key
the function that computes a key from a value
typename parent_iterator_type::value_type parent_value_type
std::shared_ptr< parent_iterator_type > parent_type
BaseStreamIterator< T > parent_iterator_type
Type alias for the "parent" iterator.
payload_type next() override
Retrieve the next iterator payload.
Stream< T > operator|(const Stream< T > &lhs, const details::filter_toolbox< T > &rhs)
Pipe operator overload for filter operations.
UniqueByOperator(parent_type p, mapper_type key)
Construct an operator from its parent iterator and the mapper function.
typename iterator_type::parent_type parent_type
U key_type
The type of keys (unique by key)
A class representing a stream iterator's payload.
Class representing a stream of data.