"http://trilinos.sandia.gov/RefCountPtrBeginnersGuideSAND.pdf
and click on: Teuchos::RCP
A: There are two ways to get at the underlying raw pointer to an object that is wrapped in the RCP<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 Teuchos::RCP::operator*() will throw an exception if Teuchos::RCP::get()==NULL when the code is configured using --enable-teuchos-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 Item 44 in "C++ Coding Standards" by Sutter and Alexandrescu for a discussion of this topic.
See the sillyCgSolve() and sillyPowerMethod() examples for how this templating is used.
A: You must use the non-member functions Thyra::createMember() and Thyra::createMembers() described here and also used in the examples sillyCgSolve() and sillyModifiedGramSchmidt().
1.4.7