Mar 20, 2014

[C++11] User-defined literals

Reference:

C++11 FAQ User-defined literals

String’s length
std::string s ("\0\0test"); // size == 0
std::string s ("\0\0test", 6); // size == 6

double operator "" _d (const char* value); // numeric
std::string operator "" _s (const char* text, size_t len); //string literal

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.