I am using a fold expression to print elements in a variadic pack, but how do I get a space in between each element?
Currently the output is \"1 234\", the desired outpu
you can that
#include
template
struct Facility
{
template
struct List
{
static void print()
{
std::cout<<"\"" << head;
((std::cout << " " << list), ...);
std::cout<<"\"";
}
};
};
template
using IntList = typename Facility::List;
int main()
{
using List1 = IntList<1,2,3,4>;
List1::print();
}
the fold expression ((std::cout << " " << list), ...)
will expands to ((std::cout << " " << list1), (std::cout << " " << list2), (std::cout << " " << list3)...)