13#ifndef RANGES_V3_EXPERIMENTAL_VIEW_SHARED_HPP
14#define RANGES_V3_EXPERIMENTAL_VIEW_SHARED_HPP
27#include <range/v3/detail/prologue.hpp>
33 namespace experimental
35 template<
typename Rng>
41 std::shared_ptr<Rng> rng_ptr_;
48 : rng_ptr_{std::make_shared<Rng>(std::move(rng))}
54 return ranges::begin(*rng_ptr_);
56 sentinel_t<Rng> end()
const
58 return ranges::end(*rng_ptr_);
62 auto CPP_fun(size)()(
const
69 template<
typename SharedFn>
72 struct RANGES_STRUCT_WITH_ADL_BARRIER(shared_closure_base)
75 template(
typename Rng,
typename SharedFn)(
77 constructible_from<detail::decay_t<Rng>, Rng>)
80 return static_cast<SharedFn &&
>(vw)(
static_cast<Rng &&
>(rng));
83 template<
typename SharedFn,
typename Pipeable>
84 friend constexpr auto operator|(shared_closure<SharedFn> sh, Pipeable pipe)
86 requires (is_pipeable_v<Pipeable>))
88 return shared_closure<composed<Pipeable, SharedFn>>{compose(
89 static_cast<Pipeable &&
>(pipe),
static_cast<SharedFn &&
>(sh))};
93 template<
typename SharedFn>
100 : SharedFn(
static_cast<SharedFn &&
>(fn))
108 template(
typename Rng)(
110 constructible_from<detail::decay_t<Rng>, Rng>)
111 shared_view<detail::decay_t<Rng>>
operator()(Rng && rng)
const
123 template<
typename SharedFn>
124 RANGES_INLINE_VAR
constexpr bool
125 is_pipeable_v<experimental::shared_closure<SharedFn>> =
true;
129#include <range/v3/detail/epilogue.hpp>
The viewable_range concept.
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
meta::size_t< L::size()> size
An integral constant wrapper that is the size of the meta::list L.
Definition: meta.hpp:1696
Definition: compose.hpp:33
Definition: shared.hpp:97
Definition: shared.hpp:38
Definition: shared.hpp:107
Definition: interface.hpp:129