#include <sstream>
#include <iostream>
using namespace std;
template<class T,class... Args>
void format_stream_help( std::ostringstream& o ,T v)
{
o<<v;
}
template<class T,class... Args>
void format_stream_help( std::ostringstream& o ,T v, Args&&... args)
{
o<<v;
format_stream_help( o , std::forward<Args>(args) ...);
}
template<class... Args>
std::string format_stream(Args&&... args)
{
std::ostringstream strSourceStream;
format_stream_help(strSourceStream , std::forward<Args>(args) ...);
return strSourceStream.str();
}
int main()
{
cout<< format_stream( "a" ,111 , "ccc" , 123 ) << endl;
return 0;
}
#include <iostream>
using namespace std;
template<class T,class... Args>
void format_stream_help( std::ostringstream& o ,T v)
{
o<<v;
}
template<class T,class... Args>
void format_stream_help( std::ostringstream& o ,T v, Args&&... args)
{
o<<v;
format_stream_help( o , std::forward<Args>(args) ...);
}
template<class... Args>
std::string format_stream(Args&&... args)
{
std::ostringstream strSourceStream;
format_stream_help(strSourceStream , std::forward<Args>(args) ...);
return strSourceStream.str();
}
int main()
{
cout<< format_stream( "a" ,111 , "ccc" , 123 ) << endl;
return 0;
}