Re:文字列バラバラ事件

文字列バラバラ事件


それmpl::for_eachで。

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

namespace mpl = boost::mpl;

struct print {
    void operator()(char c) const
    {
        std::cout << c << std::endl;
    }
};

int main()
{
    typedef mpl::string<'test'> test;

    mpl::for_each<test>(print());
}
t
e
s
t

できた。