VCCC  2024.05
VisualCamp Common C++ library
zip_transform.hpp
Go to the documentation of this file.
1 //
2 // Created by YongGyu Lee on 4/11/24.
3 //
4 
5 #ifndef VCCC_RANGES_VIEWS_ZIP_TRANSFORM_HPP_
6 #define VCCC_RANGES_VIEWS_ZIP_TRANSFORM_HPP_
7 
8 #include <type_traits>
9 
21 
22 namespace vccc {
23 namespace ranges {
24 namespace views {
25 namespace detail {
26 
28  private:
29  template<typename FD, bool = conjunction<copy_constructible<FD>, is_referencable<FD>>::value /* false */>
30  struct check : std::false_type {};
31 
32  template<typename FD>
33  struct check<FD, true>
34  : conjunction<
35  regular_invocable<FD&>,
36  std::is_object<invoke_result_t<FD&>>
37  > {};
38 
39  public:
40  template<typename F, std::enable_if_t<check<std::decay_t<F&&>>::value, int> = 0>
41  constexpr auto operator()(F&& f) const {
42  using FD = std::decay_t<decltype(f)>;
43 
44  return ((void)f, vccc_decay_copy(views::empty<std::decay_t<invoke_result_t<FD&>>>));
45  }
46 
47  template<typename F, typename... Rs>
48  constexpr auto operator()(F&& f, Rs&&... rs) const {
49  return zip_transform_view<std::decay_t<F>, views::all_t<Rs>...>(std::forward<F>(f), std::forward<Rs>(rs)...);
50  }
51 };
52 
53 } // namespace detail
54 
57 
59 
61 
62 } // namespace views
63 } // namespace ranges
64 } // namespace vccc
65 
66 #endif // VCCC_RANGES_VIEWS_ZIP_TRANSFORM_HPP_
Definition: zip_transform_view.hpp:84
#define vccc_decay_copy(x)
Definition: decay_copy.hpp:12
constexpr VCCC_INLINE_OR_STATIC detail::zip_transform_niebloid zip_transform
Definition: zip_transform.hpp:58
typename detail::all_t_impl< R >::type all_t
Calculates the suitable view type of a viewable_range type.
Definition: all.hpp:107
typename invoke_result< F, Args... >::type invoke_result_t
Definition: is_invocable.hpp:66
#define VCCC_INLINE_OR_STATIC
Definition: inline_or_static.hpp:9
constexpr VCCC_INLINE_OR_STATIC empty_view< T > empty
Definition: empty_view.hpp:53
Definition: directory.h:12
Definition: conjunction.hpp:22
constexpr auto operator()(F &&f, Rs &&... rs) const
Definition: zip_transform.hpp:48
constexpr auto operator()(F &&f) const
Definition: zip_transform.hpp:41