inline bool ArrayRCP<T>::shares_resource(const ArrayRCP<T2>& r_ptr) const { return node_.same_node(r_ptr.access_private_node()); // Note: above, r_ptr is *not* the same class type as *this so we can not // access its node_ member directly! This is an interesting detail to the // C++ protected/private protection mechanism! }
template<class T> inline ArrayRCP<T>& ArrayRCP<T>::operator=(const ArrayRCP<T>& r_ptr) { if( this == &r_ptr ) return *this; // Assignment to self node_ = r_ptr.access_private_node(); // May throw in debug mode! ptr_ = r_ptr.ptr_; lowerOffset_ = r_ptr.lowerOffset_; upperOffset_ = r_ptr.upperOffset_; return *this; // NOTE: It is critical that the assignment of ptr_ come *after* the // assignment of node_ since node_ might throw an exception! }
void debug_assert_valid_ptr() const { #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK arcp_.access_private_node().assert_valid_ptr(*this); #endif }