
On 13-05-06 10:44 PM, Olaf Peter wrote:
Have you tried:
typedef mpl::string<'hell','o wo','rld'>::type my_hello;
? BOOST_MPL_LIMIT_STRING_SIZE is a count of "characters" in the mpl::string, which is 4X the number of template parameters, since mpl::string uses multi-character literals to pack 4 characters into an int.
Thanks, Eric. This is from the examples and works. But there rises the question how to use slightly longer mpl strings.
I don't understand the problem you're having. If you want a longer string, you just add more characters: typedef mpl::string<'hell','o wo','rld ','abcd','efgh'>::type my_hello; If you want to append piecemeal, use mpl::push_back, which will do the right thing.
Further more, using this emits a compiler warning about multichar literal (or similar) on gcc. Generally disabling this warning may prevent detection of issues on other places.
Because you're using multichar literals in so many other places? ;-)
A similar compile problem I have with
typedef mpl::char<'A'>::type my_A;
int main() { std::cout << mpl::c_str
::value << '\n'; } but I haven't a compiler at the hand here.
mpl::c_str only works on mpl::strings. -- Eric Niebler Boost.org