Horizon
unique.hpp
Go to the documentation of this file.
1 // Range v3 library
3 //
4 // Copyright Eric Niebler 2013-present
5 //
6 // Use, modification and distribution is subject to the
7 // Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10 //
11 // Project home: https://github.com/ericniebler/range-v3
12 //
13 
14 #ifndef RANGES_V3_VIEW_UNIQUE_HPP
15 #define RANGES_V3_VIEW_UNIQUE_HPP
16 
17 #include <utility>
18 
19 #include <meta/meta.hpp>
20 
21 #include <range/v3/range_fwd.hpp>
22 
25 #include <range/v3/utility/static_const.hpp>
27 #include <range/v3/view/all.hpp>
28 #include <range/v3/view/view.hpp>
29 
30 #include <range/v3/detail/prologue.hpp>
31 
32 namespace ranges
33 {
36  namespace views
37  {
39  {
40  template(typename Rng, typename C = equal_to)(
41  requires viewable_range<Rng> AND forward_range<Rng> AND
44  operator()(Rng && rng, C pred = {}) const
45  {
46  return {all(static_cast<Rng &&>(rng)), not_fn(pred)};
47  }
48  };
49 
51  {
52  using unique_base_fn::operator();
53 
54  template(typename C)(
55  requires (!range<C>))
56  constexpr auto operator()(C && pred) const
57  {
58  return make_view_closure(
59  bind_back(unique_base_fn{}, static_cast<C &&>(pred)));
60  }
61  };
62 
66  } // namespace views
68 } // namespace ranges
69 
70 #include <range/v3/detail/epilogue.hpp>
71 
72 #endif
CPP_concept indirect_relation
\concept indirect_relation
Definition: concepts.hpp:670
decltype(begin(declval(Rng &))) iterator_t
Definition: access.hpp:698
RANGES_INLINE_VARIABLE(detail::to_container_fn< detail::from_range< std::vector >>, to_vector) template< template< typename... > class ContT > auto to(RANGES_HIDDEN_DETAIL(detail
For initializing a container of the specified type with the elements of an Range.
Definition: conversion.hpp:399
defer< bind_back, Fn, Ts... > bind_back
Definition: meta.hpp:994
bool_< T::type::value==U::type::value > equal_to
A Boolean integral constant wrapper around the result of comparing T::type::value and U::type::value ...
Definition: meta.hpp:237
compose< quote< not_ >, Fn > not_fn
Logically negate the result of invocable Fn.
Definition: meta.hpp:3009
Tiny meta-programming library.
Definition: adjacent_filter.hpp:63
Definition: not_fn.hpp:34
Definition: unique.hpp:39
Definition: unique.hpp:51
Definition: view.hpp:178