← Back to team overview

dolfin team mailing list archive

Re: Use of explicit

 



Anders Logg wrote:
On Thu, Jun 26, 2008 at 02:55:30PM +0200, Andy Ray Terrel wrote:
You probably don't need the explicit keyword for copy constructors as
done in Functions.h , PetscMatrix.h, uBlasMatrix.h, EpetraMatrix.h.
This has the added effect of not being able to pass functions as
arguments (perhaps that is bad but anyhow).  Having just pulled this
seemed to make my code a bit unhappy.

You should not need to have a copy constructor to pass a Function as
argument (at least by reference or as a pointer). Or are you passing
it by value? That's probably not a good idea since it would involve
copying the entire mesh as well as the vector of dofs.


This has become an annoyance for me because I do want to pass a Function by value (I really do want a copy) and I can't do

  Function f(mesh);
  std::vector<Function> F;
  F.push_back(f);

when explicit is used.

Garth



------------------------------------------------------------------------

_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev


Follow ups

References