Re: Why does this program segfault?
On Thu, Jan 17, 2002 at 09:05:47AM -0500, Anthony DeRobertis wrote:
> >The implicit copy ctor shouldn't be getting defined (there's a
> >non-default
> >ctor), so I'm not sure exactly how that's being constructed.
>
> If you don't want an implicit copy ctor, you have to do:
>
> class C {
> ...
> private:
> C(const C &);
>
> }
>
> and then never define that ctor. Otherwise, the compiler makes
> one for you. Same with operator=(const C&).
My mixup was with the default ctor (suppressed if a non-default one is
declared.)
(It'd be nice if the implicit operator= and copy ctors were suppressed
if one of those or a dtor is given, though.)
--
Glenn Maynard
Reply to: