2010-06-11 6 views
1

변환을 mpl::string에 적용하려고하지만 컴파일 할 수 없습니다. 저는 MS VC++ 2010과 Boost 1.43.0을 사용하고 있습니다. 코드 :mpl :: transform에 mpl :: transform을 적용하는 방법은 무엇입니까?

#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::transformForward Sequence을 필요로하고 mpl::string 내가 Forward Sequence의 유형입니다 모여 Bidirectional Sequence이라고 말하고, 그래서 그것을 작동 거라고 생각했다.

내가 잘못했거나 완전히 불가능합니까? 그렇다면 왜?

감사합니다.

+2

* "내가 뭔가 잘못하고 있니?"* 음, C++에서 템플릿 메타 프로그래밍을 시도하고 있습니까? *** 오리 *** –

+0

_MS_ VC 2010을 사용하는 경우 왜 _Ubuntu_ 웹 사이트에 문제를 게시하고 있습니까? – KitsuneYMG

답변

1

내가 transform_view을 사용하면 효과가 있다고합니다.

+0

이 문제는 Boost.MPL의 버그로 인한 것이므로 다음 릴리스에서 수정 될 예정입니다. http://lists.boost.org/boost-users/2010/06/60002.php –

관련 문제