Xref: utzoo comp.lang.c++:4574 gnu.g++:369 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!bionet!agate!pasteur!dougfir.Berkeley.EDU!Samples From: Samples@dougfir.Berkeley.EDU (A. Dain Samples) Newsgroups: comp.lang.c++,gnu.g++ Subject: ctors for arrays of objects? Message-ID: <16905@pasteur.Berkeley.EDU> Date: 6 Sep 89 21:41:31 GMT Sender: news@pasteur.Berkeley.EDU Lines: 31 I have recently encountered a problem with a source level profiler I am implementing. According to Stroustrop (pg 161, section 5.5.5) it is not possible to declare a vector of class objects that has constructors all of which require parameters. This seems a bit restrictive. Is there an inherent reason why this is difficult to do? Once the parameter list is determined, what is so difficult about passing it to n objects as opposed to just one object? Does G++ have the same restriction? I'm wanting to label each static occurence of the declaration of an object with a unique id: class Foo { ... }; Foo A(1); Foo B(2); : Foo Z(26)[10]; It's the declaration of the array Z that is prohibited. Any ideas on how I might get around this restriction? The best I've been able to come up with so far (short of creating class array_of_foo) is to just glump all array declarations together in the profile data. Not very satisfying. =============================================================================== A. Dain Samples, UC Berkeley, samples@dougfir.berkeley.edu, 642-9542, 785-5644 It is so difficult to find the beginning. Or, better, it is difficult to begin at the beginning. And not try to go further back. -Wittgentstein