-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Chris Forone wrote:
hello group,
why i cant make the InputIterator of the following func-temp const?
[...]
*first++ = *source++;
^^
[...]
You are post-incrementing the "source" variable, so it obviously cannot
be constant. If you need it to be const for whatever reason (eg. someone
else wrote the header and you cannot change it), just make a copy of it
(assuming the InputIterator::operator= is defined and works as expected):
InputIterator sourceCopy = source;
while (first != last)
*first++ = *sourceCopy++;
Otherwise, passing by value as in your current implementation is just fine.
I suppose, though, that you meant "const" as "iterator cannot be used to
change pointed value". I'm afraid you have to define a
ConstInputIterator for that.
Cheers,
- -Federico
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE -
http://enigmail.mozdev.org
iD4DBQFIW2fNBIpu+y7DlLcRAnqyAJ4iyDYO1eUQMTsrR8aIQD KTiqY4KwCYlC8c
E+Y9XR4j/kCu3kk320KOfg==
=z4Ib
-----END PGP SIGNATURE-----