This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Non-default ctors, virtual base classes, & multiple inheritance all at once!




> -----Original Message-----
> From: sidster [mailto:patrick@mail.boxsoft.com]
> Sent: Wednesday, September 06, 2000 9:33 AM
> To: Alexandre Oliva
> Cc: scherrey@switchco.com; gcc@gcc.gnu.org
> Subject: Re: Non-default ctors, virtual base classes, & multiple
> inheritance all at once!
> 
> If I understand what you are suggesting correctly then it is
> _impossible_ to get the desired behavior with the given code.
> 
> Since  template <typename X> class HoldX  has no knowledge of what
> base classes  X  might have to even provide constructors to specify
> them in its "mem-initializer-list".

template <typename X> class HoldX : public virtual X
{
  HoldX(int) : A(int),X(int) {};
};

Now the template parameter X is required to derive from A, restricting the
utility of HoldX.  But most template code places requirements on the
template parameters, STL being an example.  There is nothing earth
shattering about this.  Make virtual base classes abstract with no data, and
everything will work out.

JR


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]