1 #ifndef VCSN_MISC_VECTOR_HH
2 # define VCSN_MISC_VECTOR_HH
19 template <
typename Fun>
26 template<
typename Fun,
typename H,
typename... Ts>
29 std::vector<H>
const& h,
30 std::vector<Ts>
const&... ts)
33 cross([&](Ts
const&... ts) { f(he, ts...); }, ts...);
36 template<
typename Fun,
typename... Ts>
39 const std::tuple<Ts...>& ts)
44 template<
typename Fun,
typename... Ts,
size_t... I>
47 const std::tuple<Ts...>& ts,
50 cross(f, std::get<I>(ts)...);
54 template <
typename Cont>
55 std::vector<typename Cont::value_type>
58 return {std::begin(cont), std::end(cont)};
63 template <
typename T,
typename Alloc>
66 find(
const std::vector<T, Alloc>& s,
const T& e)
67 ->
typename std::vector<T, Alloc>::const_iterator
69 return std::find(std::begin(s), std::end(s), e);
73 template <
typename T,
typename Alloc>
76 has(
const std::vector<T, Alloc>& s,
const T& e)
78 return find(s, e) != std::end(s);
82 #endif // !VCSN_MISC_VECTOR_HH
void cross_tuple_(Fun f, const std::tuple< Ts...> &ts, index_sequence< I...>)
void cross_tuple(Fun f, const std::tuple< Ts...> &ts)
std::vector< typename Cont::value_type > to_vector(const Cont &cont)
Return the content of cont as a vector.
void cross(Fun f)
Variadic Cartesian product of vectors.
bool has(const std::map< Key, Value, Compare, Alloc > &s, const Key &e)
ATTRIBUTE_PURE auto find(const std::vector< T, Alloc > &s, const T &e) -> typename std::vector< T, Alloc >::const_iterator
Convenience wrapper around std::find.