Search code examples
c++boostcharacterboost-mpl

boost mpl string


Hi in boost mpl documentation I have discovered mpl::string and the following example:

typedef mpl::string<'hell','o wo','rld'> hello;

I'm a little bit surprised because I thought that in C or C++ we can't have more than one character between the character ' ?

Is it normal and valid ?


Solution

  • Yes, it is valid C++. From any existing C++ standard, section [lex.conn]:

    An ordinary character literal that contains more than one c-char is a multicharacter literal. A multicharacter literal has type int and implementation-defined value.