[spirit][iterator] position_iterator regression in 1.37.0
When using this type: boost::spirit::position_iterator<std::string::const_iterator> I get a static assertion failure: ..\..\lib\boost_1_37_0\boost/iterator/iterator_adaptor.hpp(230) : error C2027: u se of undefined type 'boost::STATIC_ASSERTION_FAILURE<x>' with [ x=false ] ..\..\lib\boost_1_37_0\boost/iterator/iterator_adaptor.hpp(335) : see re ference to function template instantiation 'void boost::detail::iterator_adaptor _assert_traversal<boost::forward_traversal_tag,boost::random_access_traversal_ta g>(void)' being compiled ..\..\lib\boost_1_37_0\boost/iterator/iterator_adaptor.hpp(334) : while compiling class template member function 'void boost::iterator_adaptor<Derived,B ase,Value,Traversal>::advance(__w64 int)' with [ Derived=boost::spirit::position_iterator<std::_String_const_iterator <char,std::char_traits<char>,std::allocator<char>>>, Base=std::_String_const_iterator<char,std::char_traits<char>,std::al locator<char>>, Value=const char, Traversal=boost::forward_traversal_tag ] ..\..\lib\boost_1_37_0\boost/spirit/home/classic/iterator/position_itera tor.hpp(156) : see reference to class template instantiation 'boost::iterator_ad aptor<Derived,Base,Value,Traversal>' being compiled with [ Derived=boost::spirit::position_iterator<std::_String_const_iterator <char,std::char_traits<char>,std::allocator<char>>>, Base=std::_String_const_iterator<char,std::char_traits<char>,std::al locator<char>>, Value=const char, Traversal=boost::forward_traversal_tag ] source/eldwood/core/lexer.cpp(81) : see reference to class template inst antiation 'boost::spirit::position_iterator<ForwardIteratorT>' being compiled with [ ForwardIteratorT=std::_String_const_iterator<char,std::char_traits<c har>,std::allocator<char>> ] This is triggered on a simple function declaration taking a position_iterator as argument, using MSVC8.0 Express on Windows XP. It worked under Boost 1.36.0. -- Rainer Deyke - rainerd@eldwood.com
2008/11/4 Rainer Deyke <rainerd@eldwood.com>:
When using this type:
boost::spirit::position_iterator<std::string::const_iterator>
This happened because position_iterator's tag has been changed to be a forward iterator - before it was incorrectly labelled as the same type of iterator as the underlying iterator, but it didn't implement them. So iterator adaptor was supplying a buggy implementation of those methods. It looks like you're using 'operator+' to increase the iterator, it wouldn't give the correct position and could easily be jumping over the wrong number of characters. If you're code was previously compiling, and you were using position_iterator to get the position, you'll probably get the wrong position. Since you didn't include any code, my suggestion is that you should use 'boost::next' to advance the iterator. Daniel
participants (2)
-
Daniel James
-
Rainer Deyke