I am trying to convert a std::tuple
to a std::set
. I have the following code
template <typename... T>
auto to_set(std::tuple<T...> const &t) {
return to_set_helper(t, std::index_sequence_for<T...>{});
}
template <typename T, size_t... Is>
auto to_set_helper(T&& t, std::index_sequence<Is...>) {
using set_t = typename std::tuple_element<0,
typename std::remove_reference<T>::type>::type;
std::set<set_t> ret;
ret.insert(std::get<Is>(t))...;
return ret;
}
The compiler complains about unpacking the parameter pack for the line
ret.insert(std::get<Is>(t))...;
I don't see what is wrong here.
Aucun commentaire:
Enregistrer un commentaire