http://software.sandia.gov/Trilinos/RefCountPtrBeginnersGuideSAND.pdf
and click on: Teuchos::RefCountPtr
A: There are two ways to get at the underlying raw pointer to an object that is wrapped in the RefCountPtr<C> object c_ptr:
C *c_rptr1 = c_ptr.get(); // Unchecked, can be NULL C *c_rptr2 = &*c_ptr; // Checked in debug build and will not return NULL
You should use c_ptr.get() when it is okay for the pointer to be NULL. On the other hand, you should use &*c_ptr when you don't want to allow the raw pointer to be NULL. This is because the operator function <tt>Teuchos::RefCountPtr::operator*() will throw an exception if Teuchos::RefCountPtr::get()==NULL when the code is compiled using the macro define -D_DEBUG.
For more information see Item 3 in Appendix B in
http://software.sandia.gov/Trilinos/RefCountPtrBeginnersGuideSAND.pdf
For more information see the main body and Appendix D of the document:
http://software.sandia.gov/Trilinos/RefCountPtrBeginnersGuideSAND.pdf
A: Generally member functions should only be used over non-member functions when direct access to private or protected data for functions is required. By minimizing the amount of code that can access non-public data you greatly simplify maintenance. See section 11.3.1 in "The C++ Programming Language: Special Edition" for a discussion of this topic.
See the Thyra::sillyCgSolve() and Thyra::sillyPowerMethod() examples for how this templating is used.
A: You must use the non-member functions Thyra::createMember() and Thyra::createMembers() described here.
1.3.9.1