easiest/laziest way would be to initialise a std::string passing in your string literal to the constructor then just call size() on that. wrap it in a function:
Ib both javascript and c++ this will create an object and immideatly destroy it. In C++ this should be remembered if you want to get pointer/reference to object/its internals.
If you want to avoid runtime expenses, you should look into constexpr functions which works neatly with string literals.
Year C++ Standard Informal name
1998 ISO/IEC 14882:1998[12] C++98
2003 ISO/IEC 14882:2003[13] C++03
2007 ISO/IEC TR 19768:2007[14] C++TR1
2011 ISO/IEC 14882:2011[4] C++11
2014 N3690 (working draft C++14)[15] C++14
2017 to be determined C++17
wiki
C++14 was standartised in August. It is already 5 month standard.
Yes. it is a syntax sugar. s at the end of string literal converts it to the std::string