I saw such code in some cross platform C++ project:
#if defined(_LIBCPP_VERSION)
#define CONCAT(EXPR) (std::stringstream() << EXPR).str()
#else
#define CONCAT(EXPR) (static_cast<std::stringstream&>(std::stringstream() << EXPR)).str()
#endif
As I understand there is feature/extension in libc++ and operator<<
return std::stringstream
, instead of std::basic_ostream<char>
, but why not use portable variant instead of this extension? What is benefit for libc++?
Aucun commentaire:
Enregistrer un commentaire