|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Jun 6, 11:17 am, Chris Forone <4...@gmx.at> wrote:
> 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:james.kanze@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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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. -- Michael |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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 |
|
![]() |
| Outils de la discussion | |
|
|