dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #22767
reference and shared_ptr interfaces
-
To:
DOLFIN Mailing List <dolfin@xxxxxxxxxxxxxxxxxxx>
-
From:
"Garth N. Wells" <gnw20@xxxxxxxxx>
-
Date:
Thu, 21 Apr 2011 16:47:05 +0100
-
User-agent:
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110419 Thunderbird/3.1.9
Having just looked at the VariationalProblem class, there is
considerable duplication of functions that return objects (there being a
reference and a shared_ptr version). I suggest that we use shared_ptr
versions, unless there is a special reason to use a reference, and
remove the reference versions (throughout the code). Reasons for this are:
1) Less code
2) shared_ptrs are now handled seamlessly by SWIG
3) shared_ptr versions are safer
4) These member functions are usually called from other parts of the
library, and developers at that level should be comfortable with
shared_ptrs.
I can imagine that we may in a limited number of cases want a reference
version to keep the user interface clean.
Garth
Follow ups