iterator value_type

C

Chris Forone

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
 
J

James Kanze

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).
 
M

Michael DOUBEZ

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.
 
C

Chris Forone

Michael said:
Chris Forone a écrit :

Looks good to me.


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top