473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Input Iterator needed for a for_each.

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:

///////////////////////////////////////////////////////////////////////////////
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 );
///////////////////////////////////////////////////////////////////////////////

with declaration as following:
///////////////////////////////////////////////////////////////////////////////
class CFG_Configuration::VM_SauvegardeCleElements
{
TRegistry * fRegistry;
AnsiString fValeur;
long fIndex;
public:
VM_SauvegardeCleElements( TRegistry * _registry, const char *
_valeur);

void operator()( const CFG_Configuration::VM_CleElement & _elt);
};
///////////////////////////////////////////////////////////////////////////////

DOes anyone what to use as iterator (or something else?) to correct
this warning?
Thx for all ur answers !
Any help would be very appreciated.
Jerome
Jul 22 '05 #1
1 1858

"JeromeG" <je************@exane.com> wrote in message
news:c6***********************@posting.google.com. ..
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:

////////////////////////////////////////////////////////////////////////////
/// 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 );
////////////////////////////////////////////////////////////////////////////
/// [snip]
DOes anyone what to use as iterator (or something else?) to correct
this warning?


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
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: sks_cpp | last post by:
I am trying to wrap the map iterator for keys and values. However, I seem to run into problems with the values for const_iterator - it works for all other combinations. Below I list my code and...
0
by: raj | last post by:
Hey all I have a base class that manages (Manager_class) different shapes. It has different arrays of Circle_class, Square_class and etc etc. All the shapes have a common base class...
4
by: Scott Smedley | last post by:
Hi all, I'm trying to write a special adaptor iterator for my program. I have *almost* succeeded, though it fails under some circumstances. See the for-loop in main(). Any pointers/help...
5
by: Thomas Matthews | last post by:
Hi, I have a Display class. I would like to write a function that takes a range of objects and displays them. The range would be specified by two forward iterators: start and end (one past...
13
by: Dan Tsafrir | last post by:
is the following code standard? (cleanly compiles under g++-4.0.2): struct Asc { bool operator()(int a, int b) {return a < b;} }; struct Des { bool operator()(int a, int b) {return b > a;} };...
6
by: samuel.y.l.cheung | last post by:
Hi, I am trying to convert a Java iterator loop to C++ STL? the loop looks like this: public static boolean func (List aList) { int minX = 0 for (Iterator iter = aList.listIterator(1);...
18
by: silversurfer | last post by:
Ok, this should be fairly easy for most of you (at least I hope so), but not for me: Let us say we have got the following elements: std::vector<Entry> models; //Entry is a struct...
3
by: Belebele | last post by:
I have an Element class which is abstract and I would like to have an object of the Iterator class to iterate over a range of elements. I would like to use std::for_each to instrument the...
3
by: bb | last post by:
Hi, Please could you clarify why 'implicit conversion' does not take place while assigning an iterator to reverse_iterator. However, it happens while initializing/constructing. e.g. typedef...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.