printf boost:tuple
Is the开发者_JS百科re're way to pass boost::tuple to printf()?
Not directly, because printf
requires certain format specifiers. You'd need to print each element out at a time.
You might make a template function that iterates over the elements of the tuple, printing them out. This question address that. That said, that again won't work unless each element can be printed out with printf
.
Rather, why not use iostream
instead? Then you can just say std::cout << theTuple
.
No, because "printf" is a C function and has no idea how to handle C++ objects. That said, if all you want to do is create a formatted message, you might want to check out The Boost Format Library.
精彩评论