This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Naked pointers in LinearVariationalProblem constructor?

0 votes

Just wondering why this constructor (with ordinary pointers to DirichletBCs) remains in dolfin

LinearVariationalProblem(const Form& a, const Form& L, Function& u, std::vector < const DirichletBC*> bcs)

It seems like the last argument should be of type
std::vector < std::shared_ptr < DirichletBC*>>

I know there is another constructor that uses this but the existence of this one requires the user to manually delete the pointers in the vector which could lead to a memory leak. Why not use a smart pointer?

asked Feb 6, 2015 by david.bernstein FEniCS User (2,000 points)
...