Boost logo

Boost Users :

Subject: [Boost-users] mpl::c_str<mpl::string<>> compile error
From: Olaf Peter (ope-devel_at_[hidden])
Date: 2013-05-04 15:24:21


Hello,

the code here doesn't compile:

#include <boost/mpl/string.hpp>
#include <iostream>

namespace mpl = boost::mpl;

typedef mpl::string<'h','e','l','l','o',' ','w','o','r','l','d'>::type
my_hello;

int main()
{
        std::cout << mpl::c_str<my_hello>::value << '\n';
        std::cout << BOOST_MPL_LIMIT_STRING_SIZE << '\n';
}

As usual, the example from docs works. The error is:

$ LANG=en g++ t.cpp -o t && ./t
t.cpp:6:64: error: wrong number of template arguments (11, should be 8)
/usr/local/include/boost/mpl/string.hpp:102:12: error: provided for
'template<int C0, int C1, int C2, int C3, int C4, int C5, int C6, int
C7> struct boost::mpl::string'
t.cpp:6:72: error: expected initializer before 'my_hello'
t.cpp: In function 'int main()':
t.cpp:10:26: error: 'my_hello' was not declared in this scope
t.cpp:10:34: error: template argument 1 is invalid

why does it complain about wrong number of template arguments?
BOOST_MPL_LIMIT_STRING_SIZE is 32?

$ svn info
...
Path: .
URL: http://svn.boost.org/svn/boost/trunk
Repository Root: http://svn.boost.org/svn/boost
Repository UUID: b8fc166d-592f-0410-95f2-cb63ce0dd405
Revision: 83988
...
$ LANG=en g++ --version
g++ (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)
...

Thanks,
Olaf


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net