LA
Size: a a a
LA
AS
🎄T
AS
VD
VD
🎄T
AS
VS
#include <string>
using namespace std;
auto s{""s};
AS
#include <string>
using namespace std;
auto s{""s};
🎄T
VD
🎄T
LA
AS
These operators are declared in the namespace std::literals::string_literals, where both literals and string_literals are inline namespaces. Access to these operators can be gained with using namespace std::literals, using namespace std::string_literals, and using namespace std::literals::string_literals.
std::chrono::duration also defines operator""s, to represent literal seconds, but it is an arithmetic literal: 10.0s and 10s are ten seconds, but "10"s is a string.
VS
ON
D:\Development\C++\some>g++ pal.cpp
pal.cpp:5:22: error: 'literals' is not a namespace-name
using namespace std::literals;
^
pal.cpp:5:30: error: expected namespace-name before ';' token
using namespace std::literals;
^
pal.cpp: In function 'int main()':
pal.cpp:26:23: error: expected ')' before 's'
IsPalindrome("ara"s);
^
pal.cpp:27:24: error: expected ')' before 's'
IsPalindrome("deer"s);
^
pal.cpp: At global scope:
pal.cpp:29:1: fatal error: Files/C++/winbuilds/include: No such file or directory
}
^
compilation terminated.
AS
D:\Development\C++\some>g++ pal.cpp
pal.cpp:5:22: error: 'literals' is not a namespace-name
using namespace std::literals;
^
pal.cpp:5:30: error: expected namespace-name before ';' token
using namespace std::literals;
^
pal.cpp: In function 'int main()':
pal.cpp:26:23: error: expected ')' before 's'
IsPalindrome("ara"s);
^
pal.cpp:27:24: error: expected ')' before 's'
IsPalindrome("deer"s);
^
pal.cpp: At global scope:
pal.cpp:29:1: fatal error: Files/C++/winbuilds/include: No such file or directory
}
^
compilation terminated.
ON
AS