Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!bionet!agate!darkstar!ucschu.ucsc.edu!ericg From: ericg@ucschu.ucsc.edu (Eric Goodman) Newsgroups: comp.lang.c++ Subject: Vector classes in 1.2 (was Re: Re vectors and clobbering...) Message-ID: <5184@darkstar.ucsc.edu> Date: 16 Jul 90 20:22:47 GMT References: <6570@helios.TAMU.EDU> Sender: usenet@darkstar.ucsc.edu Organization: UC Santa Cruz Lines: 23 In article <6570@helios.TAMU.EDU> jeffw@cs.tamu.edu (Jeffrey A Waller) writes: > I think I remember in the 1.2 Stroustrup book that to be an element of a > vector, a class must have a constructor with no arguments. > IntArray(int sz = ArraySize) should qualify, but apparently TC++ dosen't > recognize it, for a quick fix--maybe not much help, redefine > IntArray(int sz = ArraySize) as two constructors. IntArray(int sz) and > IntArray(), in which sz is set to ArraySize, maybe that will work. To be a vector type in 1.2 (and maybe later) versions, a class must have a constructor that takes no arguments *even if* they are defaulted so that none need be passed. Because the compiler implicitly passes them you're still confusing it. IntArray(int sz = ArraySize) is not a legal constructor for a vector type, its not just a TC++ bug (if it's pre 2.0). Eric Goodman, UC Santa Cruz ericg@ucschu.ucsc.edu ericg@ucschu.bitnet Eric_Goodman.staff@macmail.ucsc.edu ...!ucbvax!ucscc!ucschu!ericg