Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #9173
| From | yatremblay@bel1lin202.(none) (Yannick Tremblay) |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Array inside struct inside container |
| Date | 2011-08-22 13:20 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <j2tl32$ti4$1@dont-email.me> (permalink) |
| References | <Xns9F43865A8800Dnonenonenone@69.16.186.52> |
In article <Xns9F43865A8800Dnonenonenone@69.16.186.52>,
none <none@none.none> wrote:
>I've seen forum posts here and there asking "How do I create an STL
>container of arrays?" Or, equivalently, "How do I fix this syntax:"
>
> std::vector<float[20]> v;
The obvious answer is:
std::vector< std::vector<float> > v;
>The answers to these questions are generally one of two things:
>
>1) Use a boost::array, or
>2) Put the array in a struct, like so:
>
> // In header file
> stuct wrapper { float f[20]; };
>
> // In CPP file
> std::vector<wrapper> v;
>
>I was under the impression that things stored in STL containers needed to
>be copyable and assignable. That second option seems incorrect to me,
>unless the compiler is expected to generate both an operator= and a copy
>constructor for the struct that perform a memcpy() for the contents of f.
>
>Is it?
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Array inside struct inside container none <none@none.none> - 2011-08-16 19:12 +0000
Re: Array inside struct inside container Victor Bazarov <v.bazarov@comcast.invalid> - 2011-08-16 15:28 -0400
Re: Array inside struct inside container none <none@none.none> - 2011-08-16 20:07 +0000
Re: Array inside struct inside container Leigh Johnston <leigh@i42.co.uk> - 2011-08-16 21:18 +0100
Re: Array inside struct inside container James Kanze <james.kanze@gmail.com> - 2011-08-22 11:01 -0700
Re: Array inside struct inside container Leigh Johnston <leigh@i42.co.uk> - 2011-08-22 20:44 +0100
Re: Array inside struct inside container Leigh Johnston <leigh@i42.co.uk> - 2011-08-22 20:51 +0100
Re: Array inside struct inside container Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2011-08-16 23:26 +0200
Re: Array inside struct inside container "Bo Persson" <bop@gmb.dk> - 2011-08-17 12:29 +0200
Re: Array inside struct inside container Juha Nieminen <nospam@thanks.invalid> - 2011-08-17 13:06 +0000
Re: Array inside struct inside container yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2011-08-22 13:20 +0000
Re: Array inside struct inside container Leigh Johnston <leigh@i42.co.uk> - 2011-08-22 14:42 +0100
Re: Array inside struct inside container yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2011-08-23 09:20 +0000
csiph-web