Simple question about vectors

Started by
6 comments, last by __fold 20 years, 5 months ago
My reference says that functions like at() and resize() takes a parameter of type size_type. How do I know what size_type is for my compiler and will it be different if I use other compilers?
Advertisement
size_t is defined in stdlib.h I believe, so just look in the file.
quote:Original post by xg0blin
size_t is defined in stdlib.h I believe, so just look in the file.

He is reffering to size_type which is defined in the std::vector container.

Fold, to answer your question, size_type is defined as a type that can hold any value smaller than the maximum size that a vector container can be for the specific type of objects that it is to hold. Did that make sense? Perhaps someone can explain this better...

[edited by - chacha on October 22, 2003 10:54:39 AM]
chacha: Seems resonable. Is it always signed?
quote:Original post by __fold
Is it always signed?

Don''t you mean unsigned ?
quote:Original post by __fold
chacha: Seems resonable. Is it always signed?

No, an unsigned integral type.

[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || CUJ || MSVC++ Library Fixes || BarrysWorld || E-Mail Me ]
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || CUJ || MSVC++ Library Fixes || BarrysWorld || [email=lektrix@barrysworld.com]E-Mail Me[/email] ]
quote:Original post by xg0blin
size_t is defined in stdlib.h I believe, so just look in the file.


He means size_type in the vector type as was stated. However, size_t is defined in cstddef in the std namespace.
It actually seems to be signed.

This topic is closed to new replies.

Advertisement