-
August 19th, 2013, 11:30 AM
#18
Re: how can i convert write() procedure to cout?
Originally Posted by 2kaud
Try something like this. Note that variadic templates in c++11 are not yet implemented in MSVS2010 or 2012.
Code:
#include <iostream>
using namespace std;
void write()
{
cout << " ";
}
template <typename A, typename ...B>
void write(A argHead, B... argTail)
{
cout << argHead << " ";
write(argTail...);
}
int main(void)
{
write(1, 2, "qwerty", 4.45, "five", 6);
return 0;
}
sorry, but i get more than 2 errors:
1 - "error C2143: syntax error : missing ',' before '...' ";
2 - "error C2061: syntax error : identifier 'B'"
i use that library and the namespace. so what is wrong?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|