and click on:
A: There are two ways to get at the underlying raw pointer to an object that is wrapped in the RCP<C> object
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
For more information see Item 3 in Appendix B in
For more information see the main body and Appendix D of the document:
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.
sillyPowerMethod() examples for how this templating is used.
A: You must use the non-member functions
Thyra::createMembers() described here and also used in the examples