| re: Input Iterator needed for a for_each.
"JeromeG" <jerome.gransac@exane.com> wrote in message
news:c647b437.0406240502.fec40@posting.google.com. ..[color=blue]
> Hi,
>
> I have a project that use to be developped on WIndows NT 4.0 sp6a and
> Borland c++ builder 5.0.
> Now this project has been compiled and linked on Windows XP and
> Borland c++ 6.0.
>
> The reason i am writting this note on this group is the following:
> I have a warning on each std::for_each use.
> This warning is : Warning W8091
> "Argument template, _InputIter passed to "for_each" is an ouput
> iterator : input iterator required"
>
> Befor with BCB5, i have no warnings on the using of for_each. Here are
> the code lines:
>
>[/color]
////////////////////////////////////////////////////////////////////////////
///[color=blue]
> std::set<VM_CleElement>::const_iterator it1 =
> fElementsToujoursVisibles.begin();
> std::set<VM_CleElement>::const_iterator it2 =
> fElementsToujoursVisibles.end();
> VM_SauvegardeCleElements toto(registry.get(),
> "ElementToujoursVisible");
> std::for_each(it1, it2, toto );
>[/color]
////////////////////////////////////////////////////////////////////////////
///[color=blue]
>[/color]
[snip][color=blue]
>
> DOes anyone what to use as iterator (or something else?) to correct
> this warning?[/color]
The code is correct, the warning is wrong. std::set<T>::const_iterator is an
input iterator.
I don't know what you need to do to fix the warning, but if you can just
ignore it, it is clearly incorrect.
john |