470,815 Members | 1,094 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

iterator value_type

hello group,

is it possible to get the size of iterated object:
"sizeof(typename iterator_traits<InputIterator>::value_type);"

and NOT using dereferencing
sizeof(*theIterator); ?

thanks & hand, chris
Jun 27 '08 #1
2 2247
On Jun 6, 11:17 am, Chris Forone <4...@gmx.atwrote:
is it possible to get the size of iterated object:
"sizeof(typename iterator_traits<InputIterator>::value_type);"
and NOT using dereferencing
sizeof(*theIterator); ?
Yes, but it doesn't matter, since the argument of a sizeof
operator is never evaluated (except by the compiler, to
determine its type).

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orient�e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S�mard, 78210 St.-Cyr-l'�cole, France, +33 (0)1 30 23 00 34
Jun 27 '08 #2
Michael DOUBEZ schrieb:
Chris Forone a crit :
>is it possible to get the size of iterated object:
"sizeof(typename iterator_traits<InputIterator>::value_type);"

Looks good to me.
>and NOT using dereferencing
sizeof(*theIterator); ?

IMO nothing wrong with that since the deferencing will never occur but
the iterator_traits<>::value type is fine.
Ah, thanks. Its only because of the dereferencing. I forgot that
sizeof() ist compiler-related...

:-) cheers, chris
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Carlo Milanesi | last post: by
4 posts views Thread by Arturo Cuebas | last post: by
4 posts views Thread by Martin Smith | last post: by
reply views Thread by mailforpr | last post: by
6 posts views Thread by antani | last post: by
1 post views Thread by Axel Gallus | last post: by
2 posts views Thread by subramanian100in | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.