I would like to have only one template function. So I came up with like...
template<typename Iteratable, size_t N,
typename =
std::enable_if_t<
std::is_same_v<Iteratable, const std::initializer_list<size_t> > ||
std::is_same_v<Iteratable, const std::array<size_t, N > >
>
>
std::ostream& operator << (std::ostream& os, Iteratable& in) {
std::copy(std::begin(in), std::end(in), std::ostream_iterator<size_t>(os, " ") );
return os;
}
It seems because of N
in std::array<size_t, N>
, the specialization fails.
Is there any how not to write 2 function for this use case?
Aucun commentaire:
Enregistrer un commentaire