Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #7884
| From | Victor Bazarov <v.bazarov@comcast.invalid> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: how to create an array of objects initializing each object? |
| Date | 2011-07-16 16:13 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <ivsrcn$e3c$1@dont-email.me> (permalink) |
| References | <ivparg$e19$2@dont-email.me> <ivpbc5$grt$3@dont-email.me> <d27b659c-e81f-47ef-a212-b0a22bb3adee@z14g2000yqh.googlegroups.com> |
On 7/16/2011 1:58 PM, Paul N wrote: > On Jul 15, 1:21 pm, Victor Bazarov<v.baza...@comcast.invalid> wrote: >> On 7/15/2011 8:12 AM, vaysagekv wrote: >> >>> how to create an array of objects initializing each object? > > See FAQ 10.5. > >> You can initialize them if you provide a brace-enclosed initialiser list >> for the array. You can't do it with a dynamic array, however. > > Well, if you use a dynamic array everything does get initialised with > the default constructor. Actually, that's not entirely accurate. If there is the initializer in the form "()", it's default-initialized, if there isn't, an array of built-in types will go *uninitialized*. > Which may be what the OP wanted. If you want > the elements of the array to be different, you can do this by mesing > about with a static member or a global. V -- I do not respond to top-posted replies, please don't ask
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how to create an array of objects initializing each object? vaysagekv <kvvaysage@gmail.com> - 2011-07-15 17:42 +0530
Re: how to create an array of objects initializing each object? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-15 08:21 -0400
Re: how to create an array of objects initializing each object? Paul N <gw7rib@aol.com> - 2011-07-16 10:58 -0700
Re: how to create an array of objects initializing each object? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-16 16:13 -0400
Re: how to create an array of objects initializing each object? Virchanza <virtual@lavabit.com> - 2011-07-17 14:50 -0700
Re: how to create an array of objects initializing each object? Yakov Gerlovin <yakov.gerlovin@gmail.com> - 2011-07-18 04:24 -0700
Re: how to create an array of objects initializing each object? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-18 08:59 -0400
Re: how to create an array of objects initializing each object? Yakov Gerlovin <yakov.gerlovin@gmail.com> - 2011-07-18 08:17 -0700
Re: how to create an array of objects initializing each object? Yakov Gerlovin <yakov.gerlovin@gmail.com> - 2011-07-18 08:51 -0700
Re: how to create an array of objects initializing each object? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-18 13:34 -0400
Re: how to create an array of objects initializing each object? Leigh Johnston <leigh@i42.co.uk> - 2011-07-18 19:00 +0100
Re: how to create an array of objects initializing each object? Yakov Gerlovin <yakov.gerlovin@gmail.com> - 2011-07-19 06:56 -0700
Re: how to create an array of objects initializing each object? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-19 11:08 -0400
csiph-web