[ad_1]
On cppreference there is this example (http://en.cppreference.com/w/cpp/language/user_literal):
void operator"" _print ( const char* str )
std::cout << str;
int main()
0x123ABC_print;
Output:
0x123ABC
And I fail to understand what exactly this is doing. First I thought that 0x123ABC would just be seen as a string, but 0x123ABCHello_print doesn't compile. Then I thought that the << operator is overloaded so that it always prints itin hexadecimal form, but 123_print prints 123. Also it's case-sensitive: 0x 123abC_print prints 0x123abC.
Can someone explain this to me? On one hand it only takes integers as argument but on the other it treats them like string literals.
Thank you.
[ad_2]
لینک منبع