VCCC  2024.05
VisualCamp Common C++ library
take_while.hpp
Go to the documentation of this file.
1 //
2 // Created by YongGyu Lee on 3/27/24.
3 //
4 
5 #ifndef VCCC_RANGES_VIEWS_TAKE_WHILE_HPP_
6 #define VCCC_RANGES_VIEWS_TAKE_WHILE_HPP_
7 
8 #include <type_traits>
9 
15 #include "vccc/__ranges/view.hpp"
22 
23 namespace vccc {
24 namespace ranges {
25 namespace views {
26 namespace detail {
27 
29  template<typename R, typename Pred, std::enable_if_t<conjunction<
33  std::is_object<remove_cvref_t<Pred>>,
35  >::value, int> = 0>
36  constexpr auto operator()(R&& r, Pred&& pred) const {
37  return take_while_view<all_t<R>, std::decay_t<Pred>>(std::forward<R>(r), std::forward<Pred>(pred));
38  }
39 
40  template<typename Pred>
41  constexpr auto operator()(Pred&& pred) const {
42  return range_adaptor<take_while_niebloid, std::decay_t<Pred>>(std::forward<Pred>(pred));
43  }
44 };
45 
46 } // namespace detail
47 
50 
52 
54 
55 } // namespace views
56 } // namespace ranges
57 } // namespace vccc
58 
59 #endif // VCCC_RANGES_VIEWS_TAKE_WHILE_HPP_
Definition: range_adaptor.hpp:25
Definition: take_while_view.hpp:41
typename ranges::iterator< T >::type iterator_t
Definition: iterator_t.hpp:32
constexpr VCCC_INLINE_OR_STATIC detail::take_while_niebloid take_while
Definition: take_while.hpp:51
#define VCCC_INLINE_OR_STATIC
Definition: inline_or_static.hpp:9
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35
Definition: conjunction.hpp:22
Definition: has_typename_type.hpp:18
specifies that a callable type, when invoked with the result of dereferencing an indirectly_readable ...
Definition: indirect_unary_predicate.hpp:49
specifies a range whose iterator type satisfies input_iterator
Definition: input_range.hpp:46
specifies that a range is a view, that is, it has constant time copy/move/assignment
Definition: view.hpp:31
constexpr auto operator()(Pred &&pred) const
Definition: take_while.hpp:41
constexpr auto operator()(R &&r, Pred &&pred) const
Definition: take_while.hpp:36