Thank you for your answers Nick.
Also, to step over the elements you should use an iterator whenever possible. This makes it trivial to switch to other containers. But don't over-engineer it either (yeah there's a fine line).
Yes, that's what I usually do, and this is why I was confused in this case
By the way, there's not a lot of reason to use use classic pointers when working with vectors.
What will be the use of your 'buffer'?
I'm using an API which is expecting from the caller a buffer of data (input only) and the size of this buffer is not predictable before runtime.
As I said, the only reason I want to use the std::vector container instead of a dynamically allocated array of chars (new or malloc) is because I want to let C++ to manage copying of MyClass objects (i.e. not to implement MyClass::operator= by myself).
I find it less error prone this way...
Since you're telling me that there's no problem for the vector container, to fill-in the vector, I planned to it this way :
memcpy(&c.buffer, source_buffer_ptr, buffer_size);
Of course I will test it before...