|
![](/i/fill.gif) |
Orchid XP v8 <voi### [at] dev null> wrote:
> Warp wrote:
> > Orchid XP v8 <voi### [at] dev null> wrote:
> >> Oh, er... can you have a vector of vectors? Or would it have to be a
> >> vector of vector pointers?
> >
> > It's perfectly possible.
> OK. I just wasn't sure if it's permissible for the element type to be of
> variable size, that's all.
As Fredrik pointed out, a type in C++ always has the same size.
"std::vector<int>" is an example of a type, and each instance of it
will have the same size.
In fact, there's a keyword in C++ (and C) which can be used to get
the size (in bytes) of a type, at compile time: sizeof(YourType)
The std::vector class itself consists of a pointer and maybe a few
data members. Its contents do not change. What the vector does is that
it allocates memory dynamically. That allocated memory does not affect
the size of the std::vector object.
Anyways, these are technical details you don't have to worry about.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |