Re:Popular Myths about C++, Part 1
by StephanTLavavej on Sunday December 21, 2014 @04:03PM
(#8780943)
Sorry, wasn't checking my HN comments frequently (unlike Reddit there's no little red icon).
"meow" is a traditional string literal, whose type is const char [5] (array of 5 const chars). When you say "auto", you get the same deduction as when you pass something to a template foo(T t) taking by value. This triggers "decay", where arrays decay to pointers. Hence auto (and T) is const char *.
"meow"s is a user-defined literal (the Standard Library is a user as far as the compiler is concerned), for which you must include <string> and say "using namespace std::string_literals;" or something equivalent. The specification for UDLs says that this calls operator""s() which returns a std::string by value.
Yep, I'm the video guy. Glad you like them!
[edit] If you're the guy who does the MSDN videos on C++, thank you*. They've been incredibly useful to me.