boost mpl string
Asked Answered
I

1

13

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 ?

Integrator answered 25/4, 2011 at 10:48 Comment(2)
Just ab FYI. This (cpp-next.com/archive/2012/10/…) article has a better solution if you have c++11 available.Affected
That link is now dead :(Halide
Q
11

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.

Quadruped answered 25/4, 2011 at 11:7 Comment(1)
oh well that's why we can't have 5 characters between 'Integrator

© 2022 - 2024 — McMap. All rights reserved.