forked from ryanhaining/cppitertools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
imap.hpp
27 lines (23 loc) · 801 Bytes
/
imap.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef ITER_IMAP_H_
#define ITER_IMAP_H_
#include <utility>
#include "starmap.hpp"
#include "zip.hpp"
namespace iter {
namespace impl {
struct IMapFn : PipeableAndBindFirst<IMapFn> {
template <typename MapFunc, typename... Containers>
auto operator()(MapFunc map_func, Containers&&... containers) const
// explicitly specifying type here to allow more expressions that only
// care about the type, and don't need a valid implementation.
// See #66
-> StarMapper<MapFunc,
decltype(zip(std::forward<Containers>(containers)...))> {
return starmap(map_func, zip(std::forward<Containers>(containers)...));
}
using PipeableAndBindFirst<IMapFn>::operator();
};
}
constexpr impl::IMapFn imap{};
}
#endif