1

に変換を適用しようとしていますmpl::stringが、コンパイルできません。MS VC++2010 と Boost 1.43.0 を使用しています。コード:

#include <boost/mpl/string.hpp>
#include <boost/mpl/vector_c.hpp>
#include <boost/mpl/transform.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/mpl/arithmetic.hpp>

using namespace boost;

int main() {

    // this compiles OK
    typedef mpl::vector_c<int, 'abcd', 'efgh'> numbers;
    typedef mpl::transform<numbers, mpl::plus<mpl::_1, mpl::int_<1> > >::type result_numbers;

    // this doesn't (error C2039: 'value' : is not a member of 'boost::mpl::has_push_back_arg')
    typedef mpl::string<'abcd', 'efgh'> chars;
    typedef mpl::transform<chars, mpl::plus<mpl::_1, mpl::int_<1> > >::type result_chars;

}

完全なエラー メッセージをhttp://paste.ubuntu.com/447759/に投稿しました。

MPL ドキュメントには、mpl::transformが必要でありForward Sequencempl::stringBidirectional Sequenceが収集した は のタイプであると書かれているのでForward Sequence、うまくいくと思いました。

私は何か間違ったことをしていますか、それともこれは完全に不可能ですか? もしそうなら、なぜですか?

ありがとう!

4

1 に答える 1

1

を使用すると機能することがわかりますtransform_view

于 2010-06-15T14:16:25.680 に答える