← Back to team overview

dolfin team mailing list archive

Re: question concerning Generic* operator=

 

On Tue, Apr 29, 2008 at 07:05:58PM +0200, Martin Sandve Alnæs wrote:
> 2008/4/29 Kent-Andre Mardal <kent-and@xxxxxxxxx>:
> >
> > We have the following operator= in GenericVector
> >
> >    /// Assignment operator
> >    virtual const GenericVector& operator= (const GenericVector& x) = 0;
> >
> > and a similar one in eg. EpetraVector:
> >
> >    /// Assignment operator
> >    const EpetraVector& operator= (const EpetraVector& x);
> >
> > Is this operator an implementation of the operator in GenericVector ?
> >
> > Kent
> 
> No, because the signature is different. The signature of a function
> includes the name, const status, and specific list of argument types.
> 
> For regular functions, the return type of an overloaded function can
> be a pointer to a subclass of A if the superclass function returns A*,
> and probably similarly with references.
> 
> However, I think you showed me this did not work with operator=, and
> that was why you added the second operator signature. So if you have
> all EpetraVector references, things will work out fine. Otherwise,
> GenericVector references will be used.

Can someone (like Kent) check if the extra assignment operator is
really necessary? If it's necessary, we'll know why and otherwise we
can remove it.

-- 
Anders


References