|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817 |
- /// \file
- // Range v3 library
- //
- // Copyright Eric Niebler 2013-present
- //
- // Use, modification and distribution is subject to the
- // Boost Software License, Version 1.0. (See accompanying
- // file LICENSE_1_0.txt or copy at
- // http://www.boost.org/LICENSE_1_0.txt)
- //
- // Project home: https://github.com/ericniebler/range-v3
- //
-
- #ifndef RANGES_V3_RANGE_FWD_HPP
- #define RANGES_V3_RANGE_FWD_HPP
-
- #include <type_traits>
- #include <utility>
-
- #include <meta/meta.hpp>
-
- #include <concepts/concepts.hpp>
-
- #include <range/v3/detail/config.hpp>
- #include <range/v3/utility/static_const.hpp>
- #include <range/v3/version.hpp>
-
- /// \defgroup group-iterator Iterator
- /// Iterator functionality
-
- /// \defgroup group-range Range
- /// Core range functionality
-
- /// \defgroup group-algorithms Algorithms
- /// Iterator- and range-based algorithms, like the standard algorithms
-
- /// \defgroup group-views Views
- /// Lazy, non-owning, non-mutating, composable range views
-
- /// \defgroup group-actions Actions
- /// Eager, mutating, composable algorithms
-
- /// \defgroup group-utility Utility
- /// Utility classes
-
- /// \defgroup group-functional Functional
- /// Function and function object utilities
-
- /// \defgroup group-numerics Numerics
- /// Numeric utilities
-
- RANGES_DIAGNOSTIC_PUSH
- RANGES_DIAGNOSTIC_IGNORE_CXX17_COMPAT
-
- namespace ranges
- {
- /// \cond
- namespace views
- {
- }
-
- namespace actions
- {
- }
-
- // GCC either fails to accept an attribute on a namespace, or else
- // it ignores the deprecation attribute. Frustrating.
- #if(RANGES_CXX_VER < RANGES_CXX_STD_17 || defined(__GNUC__) && !defined(__clang__))
- inline namespace v3
- {
- using namespace ranges;
- }
-
- namespace view = views;
- namespace action = actions;
- #else
- inline namespace RANGES_DEPRECATED(
- "The name ranges::v3 namespace is deprecated. "
- "Please discontinue using it.") v3
- {
- using namespace ranges;
- }
-
- namespace RANGES_DEPRECATED(
- "The ranges::view namespace has been renamed to ranges::views. "
- "(Sorry!)") view
- {
- using namespace views;
- }
-
- namespace RANGES_DEPRECATED(
- "The ranges::action namespace has been renamed to ranges::actions. "
- "(Sorry!)") action
- {
- using namespace actions;
- }
- #endif
-
- namespace _end_
- {
- struct fn;
- }
- using end_fn = _end_::fn;
-
- namespace _size_
- {
- struct fn;
- }
-
- template<typename>
- struct result_of;
-
- template<typename Sig>
- using result_of_t RANGES_DEPRECATED(
- "ranges::result_of_t is deprecated. "
- "Please use ranges::invoke_result_t") = meta::_t<result_of<Sig>>;
- /// \endcond
-
- template<typename...>
- struct variant;
-
- struct dangling;
-
- struct make_pipeable_fn;
-
- struct pipeable_base;
-
- template<typename First, typename Second>
- struct composed;
-
- template<typename... Fns>
- struct overloaded;
-
- namespace actions
- {
- template<typename Action>
- struct action;
- }
-
- namespace views
- {
- template<typename View>
- struct view;
- }
-
- struct advance_fn;
-
- struct advance_to_fn;
-
- struct advance_bounded_fn;
-
- struct next_fn;
-
- struct prev_fn;
-
- struct distance_fn;
-
- struct iter_size_fn;
-
- template<typename T>
- struct readable_traits;
-
- template<typename T>
- struct incrementable_traits;
-
- struct view_base
- {};
-
- /// \cond
- namespace detail
- {
- template<typename T>
- struct difference_type_;
-
- template<typename T>
- struct value_type_;
- } // namespace detail
-
- template<typename T>
- using difference_type RANGES_DEPRECATED(
- "ranges::difference_type<T>::type is deprecated. Use "
- "ranges::incrementable_traits<T>::difference_type instead.") =
- detail::difference_type_<T>;
-
- template<typename T>
- using value_type RANGES_DEPRECATED(
- "ranges::value_type<T>::type is deprecated. Use "
- "ranges::readable_traits<T>::value_type instead.") = detail::value_type_<T>;
-
- template<typename T>
- struct size_type;
- /// \endcond
-
- /// \cond
- namespace detail
- {
- struct ignore_t
- {
- ignore_t() = default;
- template<typename T>
- constexpr ignore_t(T &&) noexcept
- {}
- template<typename T>
- constexpr ignore_t const & operator=(T &&) const noexcept
- {
- return *this;
- }
- };
-
- struct value_init
- {
- template<typename T>
- operator T() const
- {
- return T{};
- }
- };
-
- struct make_compressed_pair_fn;
-
- template<typename T>
- constexpr meta::_t<std::remove_reference<T>> && move(T && t) noexcept
- {
- return static_cast<meta::_t<std::remove_reference<T>> &&>(t);
- }
-
- struct as_const_fn
- {
- template<typename T>
- constexpr T const & operator()(T & t) const noexcept
- {
- return t;
- }
- template<typename T>
- constexpr T const && operator()(T && t) const noexcept
- {
- return (T &&) t;
- }
- };
-
- RANGES_INLINE_VARIABLE(as_const_fn, as_const)
-
- template<typename T>
- using as_const_t = decltype(as_const(std::declval<T>()));
-
- template<typename T>
- using decay_t = meta::_t<std::decay<T>>;
-
- template<typename T, typename R = meta::_t<std::remove_reference<T>>>
- using as_ref_t =
- meta::_t<std::add_lvalue_reference<meta::_t<std::remove_const<R>>>>;
-
- template<typename T, typename R = meta::_t<std::remove_reference<T>>>
- using as_cref_t = meta::_t<std::add_lvalue_reference<R const>>;
-
- struct get_first;
- struct get_second;
-
- template<typename Val1, typename Val2>
- struct replacer_fn;
-
- template<typename Pred, typename Val>
- struct replacer_if_fn;
-
- template<typename I>
- struct move_into_cursor;
-
- template<typename Int>
- struct from_end_;
-
- template<typename... Ts>
- constexpr int ignore_unused(Ts &&...)
- {
- return 42;
- }
-
- template<int I>
- struct priority_tag : priority_tag<I - 1>
- {};
-
- template<>
- struct priority_tag<0>
- {};
-
- template<typename T>
- using is_trivial = meta::bool_<
- #if META_CXX_TRAIT_VARIABLE_TEMPLATES
- std::is_trivially_copyable_v<T> &&
- std::is_trivially_default_constructible_v<T>>;
- #else
- std::is_trivially_copyable<T>::value &&
- std::is_trivially_default_constructible<T>::value>;
- #endif
-
- #if defined(__clang__) && !defined(_LIBCPP_VERSION)
- template<typename T, typename... Args>
- using is_trivially_constructible =
- meta::bool_<__is_trivially_constructible(T, Args...)>;
- template<typename T>
- using is_trivially_default_constructible = is_trivially_constructible<T>;
- template<typename T>
- using is_trivially_copy_constructible = is_trivially_constructible<T, T const &>;
- template<typename T>
- using is_trivially_move_constructible = is_trivially_constructible<T, T>;
- template<typename T, typename U>
- using is_trivially_assignable = meta::bool_<__is_trivially_assignable(T, U)>;
- template<typename T>
- using is_trivially_copy_assignable = is_trivially_assignable<T &, T const &>;
- template<typename T>
- using is_trivially_move_assignable = is_trivially_assignable<T &, T>;
- template<typename T>
- using is_trivially_copyable = meta::bool_<__is_trivially_copyable(T)>;
- #else
- template<typename T>
- using is_trivially_default_constructible = std::is_trivially_constructible<T>;
- using std::is_trivially_copy_assignable;
- using std::is_trivially_copy_constructible;
- using std::is_trivially_copyable;
- using std::is_trivially_move_assignable;
- using std::is_trivially_move_constructible;
- #endif
-
- #if RANGES_CXX_LIB_IS_FINAL > 0
- #if defined(__clang__) && !defined(_LIBCPP_VERSION)
- template<typename T>
- using is_final = meta::bool_<__is_final(T)>;
- #else
- using std::is_final;
- #endif
- #else
- template<typename T>
- using is_final = std::false_type;
- #endif
-
- // Work around libc++'s buggy std::is_function
- // Function types here:
- template<typename T>
- char (&is_function_impl_(priority_tag<0>))[1];
-
- // Array types here:
- template<typename T, typename = decltype((*(T *)0)[0])>
- char (&is_function_impl_(priority_tag<1>))[2];
-
- // Anything that can be returned from a function here (including
- // void and reference types):
- template<typename T, typename = T (*)()>
- char (&is_function_impl_(priority_tag<2>))[3];
-
- // Classes and unions (including abstract types) here:
- template<typename T, typename = int T::*>
- char (&is_function_impl_(priority_tag<3>))[4];
-
- template<typename T>
- RANGES_INLINE_VAR constexpr bool is_function_v =
- sizeof(detail::is_function_impl_<T>(priority_tag<3>{})) == 1;
-
- template<typename T>
- struct remove_rvalue_reference
- {
- using type = T;
- };
-
- template<typename T>
- struct remove_rvalue_reference<T &&>
- {
- using type = T;
- };
-
- template<typename T>
- using remove_rvalue_reference_t = meta::_t<remove_rvalue_reference<T>>;
-
- // Workaround bug in the Standard Library:
- // From cannot be an incomplete class type despite that
- // is_convertible<X, Y> should be equivalent to is_convertible<X&&, Y>
- // in such a case.
- template<typename From, typename To>
- using is_convertible =
- std::is_convertible<meta::_t<std::add_rvalue_reference<From>>, To>;
- } // namespace detail
- /// \endcond
-
- struct begin_tag
- {};
- struct end_tag
- {};
- struct copy_tag
- {};
- struct move_tag
- {};
-
- template<typename T>
- using uncvref_t = meta::_t<std::remove_cv<meta::_t<std::remove_reference<T>>>>;
-
- struct not_equal_to;
- struct equal_to;
- struct less;
- struct identity;
- template<typename Pred>
- struct logical_negate;
-
- enum cardinality : std::ptrdiff_t
- {
- infinite = -3,
- unknown = -2,
- finite = -1
- };
-
- template<typename Rng, typename Void = void>
- struct range_cardinality;
-
- template<typename Rng>
- using is_finite = meta::bool_<range_cardinality<Rng>::value >= finite>;
-
- template<typename Rng>
- using is_infinite = meta::bool_<range_cardinality<Rng>::value == infinite>;
-
- template<typename S, typename I>
- RANGES_INLINE_VAR constexpr bool disable_sized_sentinel = false;
-
- template<typename Cur>
- struct basic_mixin;
-
- template<typename Cur>
- struct RANGES_EMPTY_BASES basic_iterator;
-
- template<cardinality>
- struct basic_view : view_base
- {};
-
- template<typename Derived, cardinality C = finite>
- struct view_facade;
-
- template<typename Derived, typename BaseRng,
- cardinality C = range_cardinality<BaseRng>::value>
- struct view_adaptor;
-
- template<typename I, typename S>
- struct common_iterator;
-
- /// \cond
- namespace detail
- {
- template<typename I>
- struct cpp17_iterator_cursor;
-
- template<typename I>
- using cpp17_iterator = basic_iterator<cpp17_iterator_cursor<I>>;
- } // namespace detail
- /// \endcond
-
- template<typename First, typename Second>
- struct compressed_pair;
-
- template<typename T>
- struct bind_element;
-
- template<typename T>
- using bind_element_t = meta::_t<bind_element<T>>;
-
- template<typename Derived, cardinality = finite>
- struct view_interface;
-
- template<typename T>
- struct istream_view;
-
- template<typename I, typename S = I>
- struct RANGES_EMPTY_BASES iterator_range;
-
- template<typename I, typename S = I>
- struct sized_iterator_range;
-
- template<typename T>
- struct reference_wrapper;
-
- // Views
- //
- template<typename Rng, typename Pred>
- struct RANGES_EMPTY_BASES adjacent_filter_view;
-
- namespace views
- {
- struct adjacent_filter_fn;
- }
-
- template<typename Rng, typename Pred>
- struct RANGES_EMPTY_BASES adjacent_remove_if_view;
-
- namespace views
- {
- struct adjacent_remove_if_fn;
- }
-
- namespace views
- {
- struct all_fn;
- }
-
- template<typename Rng>
- struct const_view;
-
- namespace views
- {
- struct const_fn;
- }
-
- template<typename I>
- struct counted_view;
-
- namespace views
- {
- struct counted_fn;
- }
-
- struct default_sentinel_t;
-
- template<typename I>
- struct move_iterator;
-
- template<typename I>
- using move_into_iterator = basic_iterator<detail::move_into_cursor<I>>;
-
- template<typename Rng, bool = (bool)is_infinite<Rng>()>
- struct RANGES_EMPTY_BASES cycled_view;
-
- namespace views
- {
- struct cycle_fn;
- }
-
- /// \cond
- namespace detail
- {
- template<typename I>
- struct reverse_cursor;
- }
- /// \endcond
-
- template<typename I>
- using reverse_iterator = basic_iterator<detail::reverse_cursor<I>>;
-
- template<typename T>
- struct empty_view;
-
- namespace views
- {
- struct empty_fn;
- }
-
- template<typename Rng, typename Fun>
- struct group_by_view;
-
- namespace views
- {
- struct group_by_fn;
- }
-
- template<typename Rng>
- struct indirect_view;
-
- namespace views
- {
- struct indirect_fn;
- }
-
- struct unreachable_sentinel_t;
-
- template<typename From, typename To = unreachable_sentinel_t>
- struct iota_view;
-
- template<typename From, typename To = From>
- struct closed_iota_view;
-
- namespace views
- {
- struct iota_fn;
- struct closed_iota_fn;
- } // namespace views
-
- template<typename Rng>
- struct join_view;
-
- template<typename Rng, typename ValRng>
- struct join_with_view;
-
- namespace views
- {
- struct join_fn;
- }
-
- template<typename... Rngs>
- struct concat_view;
-
- namespace views
- {
- struct concat_fn;
- }
-
- template<typename Rng, typename Fun>
- struct partial_sum_view;
-
- namespace views
- {
- struct partial_sum_fn;
- }
-
- template<typename Rng>
- struct move_view;
-
- namespace views
- {
- struct move_fn;
- }
-
- template<typename Rng>
- struct ref_view;
-
- namespace views
- {
- struct ref_fn;
- }
-
- template<typename Val>
- struct repeat_view;
-
- namespace views
- {
- struct repeat_fn;
- }
-
- template<typename Rng>
- struct RANGES_EMPTY_BASES reverse_view;
-
- namespace views
- {
- struct reverse_fn;
- }
-
- template<typename Rng>
- struct slice_view;
-
- namespace views
- {
- struct slice_fn;
- }
-
- // template<typename Rng, typename Fun>
- // struct split_view;
-
- // namespace views
- // {
- // struct split_fn;
- // }
-
- template<typename Rng>
- struct single_view;
-
- namespace views
- {
- struct single_fn;
- }
-
- template<typename Rng>
- struct stride_view;
-
- namespace views
- {
- struct stride_fn;
- }
-
- template<typename Rng>
- struct take_view;
-
- namespace views
- {
- struct take_fn;
- }
-
- /// \cond
- namespace detail
- {
- template<typename Rng>
- struct is_random_access_common_;
-
- template<typename Rng,
- bool IsRandomAccessCommon = is_random_access_common_<Rng>::value>
- struct take_exactly_view_;
- } // namespace detail
- /// \endcond
-
- template<typename Rng>
- using take_exactly_view = detail::take_exactly_view_<Rng>;
-
- namespace views
- {
- struct take_exactly_fn;
- }
-
- template<typename Rng, typename Pred>
- struct iter_take_while_view;
-
- template<typename Rng, typename Pred>
- struct take_while_view;
-
- namespace views
- {
- struct iter_take_while_fn;
- struct take_while_fn;
- } // namespace views
-
- template<typename Rng, typename Regex, typename SubMatchRange>
- struct tokenize_view;
-
- namespace views
- {
- struct tokenize_fn;
- }
-
- template<typename Rng, typename Fun>
- struct iter_transform_view;
-
- template<typename Rng, typename Fun>
- struct transform_view;
-
- namespace views
- {
- struct transform_fn;
- }
-
- template<typename Rng, typename Val1, typename Val2>
- using replace_view = iter_transform_view<Rng, detail::replacer_fn<Val1, Val2>>;
-
- template<typename Rng, typename Pred, typename Val>
- using replace_if_view = iter_transform_view<Rng, detail::replacer_if_fn<Pred, Val>>;
-
- namespace views
- {
- struct replace_fn;
-
- struct replace_if_fn;
- } // namespace views
-
- template<typename Rng, typename Pred>
- struct trim_view;
-
- namespace views
- {
- struct trim_fn;
- }
-
- template<typename I>
- struct unbounded_view;
-
- namespace views
- {
- struct unbounded_fn;
- }
-
- template<typename Rng>
- using unique_view = adjacent_filter_view<Rng, logical_negate<equal_to>>;
-
- namespace views
- {
- struct unique_fn;
- }
-
- template<typename Rng>
- using keys_range_view = transform_view<Rng, detail::get_first>;
-
- template<typename Rng>
- using values_view = transform_view<Rng, detail::get_second>;
-
- namespace views
- {
- struct keys_fn;
-
- struct values_fn;
- } // namespace views
-
- template<typename Fun, typename... Rngs>
- struct iter_zip_with_view;
-
- template<typename Fun, typename... Rngs>
- struct zip_with_view;
-
- template<typename... Rngs>
- struct zip_view;
-
- namespace views
- {
- struct iter_zip_with_fn;
-
- struct zip_with_fn;
-
- struct zip_fn;
- } // namespace views
- } // namespace ranges
-
- namespace ranges
- {
- namespace concepts = ::concepts;
- using namespace ::concepts::defs;
- using ::concepts::and_v;
- // namespace lazy
- // {
- // using namespace ::concepts::defs::lazy;
- // }
- namespace defer
- {
- using namespace ::concepts::defs::defer;
- }
- } // namespace ranges
-
- RANGES_DIAGNOSTIC_POP
-
- /// \endcond
-
- #endif
|