折りたたみ式を使用して要素を可変個パックに出力していますが、各要素の間にスペースを入れるにはどうすればよいですか?
現在の出力は「1 234」で、希望の出力は「1 2 3 4」です。
template<typename T, typename Comp = std::less<T> >
struct Facility
{
template<T ... list>
struct List
{
static void print()
{
}
};
template<T head,T ... list>
struct List<head,list...>
{
static void print()
{
std::cout<<"\""<<head<<" ";
(std::cout<<...<<list);
}
};
};
template<int ... intlist>
using IntList = typename Facility<int>::List<intlist...>;
int main()
{
using List1 = IntList<1,2,3,4>;
List1::print();
}