Board index » cppbuilder » Re: When is a boost::bidirectional_traversal_tag not a forward iterator?

Re: When is a boost::bidirectional_traversal_tag not a forward iterator?


2006-03-07 11:47:32 PM
cppbuilder26
Andrue Cope [TeamB] wrote:
Quote
I'm trying to use a file iterator we developed a while ago (using
boost::iterator_facade) with std::equal_range.

I'm getting the warning:

[C++ Warning] DirQuick.cpp(205): W8092 template argument
ForwardIterator passed to 'equal_range' is not an iterator: forward
iterator required

I can make this go away by changing the tag in the iterator
declaration but should I even be concerned about it? After all
logically (for whatever that's worth) a bidirectional iterator can
move forward.
This is almost certainly a bogus warning from BCB and should be
disabled/ignored. We disable both warnings 8091 and 8092 as generally
firing false positives.
In fact, I believe warning 8091 was supposed to be removed from the
BCB2006 compiler, so it does not show on the Warnings page, making it
kind of hard to disable ;? You can do with by adding w-8091 to the
final page of compiler options, under 'other command line switches'
--
AlisdairM(TeamB)
 
 

Re:Re: When is a boost::bidirectional_traversal_tag not a forward iterator?

I'm trying to use a file iterator we developed a while ago (using
boost::iterator_facade) with std::equal_range.
I'm getting the warning:
[C++ Warning] DirQuick.cpp(205): W8092 template argument
ForwardIterator passed to 'equal_range' is not an iterator: forward
iterator required
I can make this go away by changing the tag in the iterator declaration
but should I even be concerned about it? After all logically (for
whatever that's worth) a bidirectional iterator can move forward.
--
Andrue Cope [TeamB]
[Bicester, Uk]
info.borland.com/newsgroups/guide.html
 

Re:Re: When is a boost::bidirectional_traversal_tag not a forward iterator?

Thanks, it does seem to work.
It works better when I change the seek position from double to 'QWORD'
though :)
--
Andrue Cope [TeamB]
[Bicester, Uk]
info.borland.com/newsgroups/guide.html
 

{smallsort}

Re:Re: When is a boost::bidirectional_traversal_tag not a forward iterator?

Andrue Cope [TeamB] wrote:
Quote
I'm trying to use a file iterator we developed a while ago (using
boost::iterator_facade) with std::equal_range.

I'm getting the warning:

[C++ Warning] DirQuick.cpp(205): W8092 template argument
ForwardIterator passed to 'equal_range' is not an iterator: forward
iterator required

I can make this go away by changing the tag in the iterator declaration
but should I even be concerned about it? After all logically (for
whatever that's worth) a bidirectional iterator can move forward.
boost::bidirectional_traversal_tag is not necessarily a forward
iterator. Strictly speaking, you also need the lvalue iterator category
to be a true forward iterator.
However, in terms of boost's iterator categories, equal_range only
requires a Forward Traversal Iterator and Readable Iterator (both of
which I suspect your file iterator models), but obviously the warning is
checking for a true forward iterator, which you aren't providing.
In any case, the warning is bogus in practice, assuming your iterator is
"readable".
Tom