33 using Teuchos::arcpCloneNode;
34 using Teuchos::arcp_reinterpret_cast;
35 using Teuchos::arcp_reinterpret_cast_nonpod;
55 ArrayRCP<A> a_arcp = arcp<A>(1);
62 const ArrayRCP<A> a1_arcp;
63 const ArrayRCP<const A> a2_arcp = a1_arcp.getConst();
70 const ArrayRCP<A> a_arcp;
71 const ArrayView<A> av = a_arcp();
78 const ArrayRCP<const A> a_arcp;
79 const ArrayView<const A> av = a_arcp();
86 const ArrayRCP<const A> a_arcp;
87 const ArrayView<const A> av = a_arcp(0, 0);
94 const ArrayRCP<const A> a_arcp;
95 const ArrayView<const A> av = a_arcp.view(0, 0);
102 const ArrayRCP<const A> a_arcp;
103 const ArrayRCP<const A> a_arcp2 = a_arcp.persistingView(0, 0);
111 ArrayRCP<A> arcp_view(data, 0, 10,
false);
112 ArrayView<A> view = arcp_view(0, 5);
114 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
115 TEST_THROW(view.size(), DanglingReferenceError);
123 const ArrayRCP<A> a_arcp;
124 const ArrayRCP<const A> ac_arcp = a_arcp;
131 TEST_THROW(
const ArrayRCP< void> v_arcp, std::logic_error );
132 TEST_THROW(
const ArrayRCP<const void> cv_arcp, std::logic_error );
138 ArrayRCP<A> a_arcp = arcp<A>(1);
139 delete [] a_arcp.release();
145 ArrayRCP<A> a_arcp = arcp<A>(0, 0, -1,
false);
152 ArrayRCP<A> a_arcp = arcp<A, Teuchos::DeallocNull<A> >(0, 0, -1,
160 const RCP<std::vector<int> > v_rcp;
161 const ArrayRCP<int> a_arcp =
arcp(v_rcp);
168 const RCP<const std::vector<int> > v_rcp;
169 const ArrayRCP<const int> a_arcp =
arcp(v_rcp);
176 const RCP<std::vector<int> > v_rcp =
rcp(
new std::vector<int>);
177 const ArrayRCP<int> a_arcp =
arcp(v_rcp);
184 const RCP<const std::vector<int> > v_rcp =
rcp(
new std::vector<int>);
185 const ArrayRCP<const int> a_arcp =
arcp(v_rcp);
192 const ArrayRCP<const int> a_arcp =
193 Teuchos::arcpWithEmbeddedObj<int>(
new int[1], 0, 1, as<int>(1),
true);
194 const int embeddedObj = Teuchos::getEmbeddedObj<int,int>(a_arcp);
201 ECHO(ArrayRCP<int> a_arcp = arcp<int>(10));
213 ECHO(ArrayRCP<int> arcp1 = arcp<int>(10));
216 ECHO(ArrayRCP<int> arcp2 = arcp1.create_weak());
224 ECHO(ArrayRCP<int> arcp3 = arcp2.create_strong());
243 ECHO(ArrayRCP<char> arcp_char =
null);
244 ECHO(ArrayRCP<int> arcp_int = arcp_reinterpret_cast<int>(arcp_char));
252 const int sizeOfInt =
sizeof(int);
253 const int sizeOfChar =
sizeof(char);
254 const int num_ints =
n;
255 const int num_chars = (num_ints*sizeOfInt)/sizeOfChar;
256 out <<
"num_ints = " << num_ints <<
"\n";
257 out <<
"num_chars = " << num_chars <<
"\n";
259 ECHO(ArrayRCP<char> arcp_char = arcp<char>(num_chars));
260 ECHO(ArrayRCP<int> arcp_int = arcp_reinterpret_cast<int>(arcp_char));
263 implicit_ptr_cast<void>(&arcp_char[0]));
264 TEST_EQUALITY(implicit_ptr_cast<void>((&arcp_int[num_ints-1])+1),
265 implicit_ptr_cast<void>((&arcp_char[num_chars-1])+1));
267 ECHO(arcp_char+=sizeOfInt);
268 ECHO(arcp_int = arcp_reinterpret_cast<int>(arcp_char));
273 implicit_ptr_cast<void>(&arcp_char[-sizeOfInt])
275 TEST_EQUALITY( implicit_ptr_cast<void>((&arcp_int[num_ints-2])+1),
276 implicit_ptr_cast<void>((&arcp_char[num_chars-1-sizeOfInt])+1));
284 const int sizeOfInt =
sizeof(int);
285 const int sizeOfChar =
sizeof(char);
286 const int num_ints =
n;
287 const int num_chars = (num_ints*sizeOfInt)/sizeOfChar;
288 out <<
"num_ints = " << num_ints <<
"\n";
289 out <<
"num_chars = " << num_chars <<
"\n";
291 ECHO(ArrayRCP<int> arcp_int = arcp<int>(num_ints));
292 ECHO(ArrayRCP<char> arcp_char = arcp_reinterpret_cast<char>(arcp_int));
295 implicit_ptr_cast<void>(&arcp_char[0]));
296 TEST_EQUALITY(implicit_ptr_cast<void>((&arcp_int[num_ints-1])+1),
297 implicit_ptr_cast<void>((&arcp_char[num_chars-1])+1));
298 TEST_EQUALITY(implicit_ptr_cast<void>((&arcp_int[num_ints-1])+1),
299 implicit_ptr_cast<void>((&arcp_char[num_chars-1])+1));
302 ECHO(arcp_char = arcp_reinterpret_cast<char>(arcp_int));
303 TEST_EQUALITY(as<int>(arcp_char.lowerOffset()), as<int>(-sizeOfInt));
304 TEST_EQUALITY(as<int>(arcp_char.upperOffset()), as<int>(num_chars-1-sizeOfInt));
306 implicit_ptr_cast<void>(&arcp_char[-sizeOfInt]));
307 TEST_EQUALITY(implicit_ptr_cast<void>((&arcp_int[num_ints-2])+1),
308 implicit_ptr_cast<void>((&arcp_char[num_chars-1-sizeOfInt])+1));
315 ECHO(ArrayRCP<ArrayRCP<int> > arcp1 =
arcp<ArrayRCP<int> >(
n));
316 ECHO(ArrayRCP<ArrayRCP<const int> > arcp2 =
320 implicit_ptr_cast<const void>(&arcp2[0]));
321 ECHO(ArrayRCP<
const ArrayRCP<const int> > arcp3 = arcp2);
324 implicit_ptr_cast<const void>(&arcp3[0]));
325 out <<
"arcp3 = " << arcp3 <<
"\n";
336 ECHO(ArrayRCP<ArrayRCP<int> > arcp1 =
null);
345 ECHO(ArrayRCP<int> arcp1 = arcp<int>(
n));
352 ECHO(ArrayRCP<int> arcp3 = arcp2);
357 ECHO(ArrayRCP<int> arcp4 = arcp1);
393 MockObject(
int member_in = -1) : member_(member_in) { ++(numConstructorsCalled()); }
394 MockObject(
const MockObject &mo) : member_(mo.member_) { ++(numCopyConstructorsCalled()); }
395 ~MockObject() { ++(numDestructorsCalled()); }
396 int member()
const {
return member_; }
398 static int & numConstructorsCalled()
399 {
static int s_numConstructorsCalled = 0;
return s_numConstructorsCalled; }
400 static int & numCopyConstructorsCalled()
401 {
static int s_numCopyConstructorsCalled = 0;
return s_numCopyConstructorsCalled; }
402 static int & numDestructorsCalled()
403 {
static int s_numDestructorsCalled = 0;
return s_numDestructorsCalled; }
404 static void reset() { numConstructorsCalled() = numCopyConstructorsCalled() = numDestructorsCalled() = 0; }
412 const int sizeOfMockObject =
sizeof(MockObject);
413 const int sizeOfChar =
sizeof(char);
414 const int num_objs =
n;
415 const int num_chars = (num_objs*sizeOfMockObject)/sizeOfChar;
416 out <<
"num_objs = " << num_objs <<
"\n";
417 out <<
"num_chars = " << num_chars <<
"\n";
419 ECHO(ArrayRCP<char> arcp_chars = arcp<char>(num_chars));
421 ECHO(MockObject::reset());
425 ECHO(ArrayRCP<MockObject> arcp_objs =
426 arcp_reinterpret_cast_nonpod<MockObject>(arcp_chars));
429 TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
432 int sum = 0;
for (
int i=0; i < num_objs; ++i) sum += arcp_objs[i].member();
436 ECHO(ArrayRCP<MockObject> arcp_objs2 = arcp_objs);
439 TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
442 int sum = 0;
for (
int i=0; i < num_objs; ++i) sum += arcp_objs[i].member();
448 TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
453 TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
454 TEST_EQUALITY(MockObject::numDestructorsCalled(), num_objs + 1);
462 const int sizeOfMockObject =
sizeof(MockObject);
463 const int sizeOfChar =
sizeof(char);
464 const int num_objs =
n;
465 const int num_chars = (num_objs*sizeOfMockObject)/sizeOfChar;
466 out <<
"num_objs = " << num_objs <<
"\n";
467 out <<
"num_chars = " << num_chars <<
"\n";
469 ECHO(ArrayRCP<char> arcp_chars = arcp<char>(num_chars));
471 ECHO(MockObject::reset());
475 ECHO(
const MockObject mockObj(1));
480 ECHO(MockObject::reset());
484 ECHO(ArrayRCP<MockObject> arcp_objs =
488 TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
491 int sum = 0;
for (
int i=0; i < num_objs; ++i) sum += arcp_objs[i].member();
495 ECHO(ArrayRCP<MockObject> arcp_objs2 = arcp_objs);
498 TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
501 int sum = 0;
for (
int i=0; i < num_objs; ++i) sum += arcp_objs[i].member();
507 TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
512 TEST_EQUALITY(MockObject::numCopyConstructorsCalled(), num_objs);
527 ECHO(ArrayRCP<A> a_arcp1 =
arcp(a_ptr, 0,
n));
528 #if defined(TEUCHOS_DEBUG)
532 TEST_THROW(ArrayRCP<A> a_arcp2 =
arcp(a_ptr, 0,
n), DuplicateOwningRCPError);
535 ECHO(ArrayRCP<A> a_arcp2 =
arcp(a_ptr, 0,
n));
537 ECHO(a_arcp2.release());
546 ECHO(ArrayRCP<A> a_arcp1 =
arcp(a_ptr, 0,
n));
547 ECHO(ArrayRCP<A> a_arcp2 =
arcp(a_ptr, 0,
n,
false));
549 #if defined(TEUCHOS_DEBUG)
552 TEST_THROW(a_arcp2.getRawPtr(), DanglingReferenceError);
564 RCP<std::ostream > out_;
566 WeirdDealloc(
int size,
const RCP<std::ostream> &out) : size_(size), out_(out) {}
567 void free(
void *ptr)
const
569 int *
const int_ptr =
reinterpret_cast<int*
>(ptr);
575 assert(tmpav[0] == int_ptr[0]);
576 *out_ << tmpav << std::endl;
579 ArrayView<const int> tmpav2(tmpav);
580 assert(tmpav2[0] == int_ptr[0]);
581 *out_ << tmpav2 << std::endl;
584 ArrayView<const int> tmpav3;
586 assert(tmpav3[0] == int_ptr[0]);
587 *out_ << tmpav2 << std::endl;
596 using Teuchos::rcpFromRef;
598 const bool ownsMem =
true;
599 int *int_ptr =
new int[
size];
600 std::fill_n(int_ptr, size, 0);
601 ArrayRCP<int> a = arcp<int>( int_ptr , 0,
size,
602 WeirdDealloc(size,
rcpFromRef(out)), ownsMem );
614 std::vector<T> a(
n, as<T>(1));
615 ArrayRCP<T> a_arcp(
n, as<T>(1));
629 const T val = as<T>(1);
633 a_arcp.assign(as<Ordinal>(
n), val);
640 const T val = as<T>(1);
644 a_arcp.assign(a.begin(), a.end());
651 typedef typename ArrayRCP<T>::const_iterator const_iterator;
652 ECHO(ArrayRCP<T> a_arcp = arcp<T>(
n));
653 ECHO(const_iterator itr = a_arcp.begin());
654 out <<
"itr = " << itr <<
"\n";
657 out <<
"itr = " << itr <<
"\n";
664 const T val = as<T>(1);
667 ArrayRCP<T> a_arcp = arcp<T>(
n);
668 ArrayRCP<T> a_arcp_cpy = a_arcp;
669 a_arcp.deepCopy(Teuchos::arrayViewFromVector(a));
677 const T val1 = as<T>(1);
678 const T val2 = as<T>(2);
683 out <<
"\nChecking resize(n, val1) ...\n";
685 a_arcp.resize(
n, val1);
688 out <<
"\nChecking resize(2*n, val2) ...\n";
690 a_arcp.resize(2*
n, val2);
693 out <<
"\nChecking resize(n/2) ...\n";
698 out <<
"\nChecking resize(0) ...\n";
706 TEST_THROW(a_arcp.resize(1), std::out_of_range);
713 ArrayRCP<T> a_arcp = arcp<T>(
n);
722 typedef ArrayRCP<T> iter_t;
731 ECHO(ArrayRCP<T> arcp1 = arcp<T>(
n));
732 ECHO(ArrayRCP<const T> arcp2 = arcp1);
741 ECHO(ArrayRCP<T> arcp_strong = arcp<T>(
n));
749 ECHO(ArrayRCP<T> arcp_weak1 = arcp_strong.create_weak());
766 TEST_EQUALITY( arcp_weak1.getRawPtr(), arcp_strong.getRawPtr() );
768 ECHO(ArrayRCP<T> arcp_weak2 = arcp_weak1);
786 TEST_EQUALITY( arcp_weak2.getRawPtr(), arcp_strong.getRawPtr() );
817 ECHO(arcp_weak1.assert_not_null());
818 ECHO(arcp_weak2.assert_not_null());
820 TEST_THROW( arcp_weak1.assert_valid_ptr(), DanglingReferenceError );
822 TEST_THROW( arcp_weak1.operator->(), DanglingReferenceError );
823 TEST_THROW( *arcp_weak1, DanglingReferenceError );
824 TEST_THROW( arcp_weak1.create_weak(), DanglingReferenceError );
825 TEST_THROW( arcp_weak1.get(), DanglingReferenceError );
826 TEST_THROW( arcp_weak1.getRawPtr(), DanglingReferenceError );
827 TEST_THROW( arcp_weak1[0], DanglingReferenceError );
828 TEST_THROW( ++arcp_weak1, DanglingReferenceError );
829 TEST_THROW( arcp_weak1++, DanglingReferenceError );
830 TEST_THROW( --arcp_weak1, DanglingReferenceError );
831 TEST_THROW( arcp_weak1--, DanglingReferenceError );
832 TEST_THROW( arcp_weak1+=1, DanglingReferenceError );
833 TEST_THROW( arcp_weak1-=1, DanglingReferenceError );
834 TEST_THROW( arcp_weak1+1, DanglingReferenceError );
835 TEST_THROW( arcp_weak1-1, DanglingReferenceError );
836 TEST_THROW( arcp_weak1.getConst(), DanglingReferenceError );
837 TEST_THROW( arcp_weak1.persistingView(0,
n), DanglingReferenceError );
838 TEST_THROW( arcp_weak1.lowerOffset(), DanglingReferenceError );
839 TEST_THROW( arcp_weak1.upperOffset(), DanglingReferenceError );
840 TEST_THROW( arcp_weak1.size(), DanglingReferenceError );
841 TEST_THROW( arcp_weak1.begin(), DanglingReferenceError );
842 TEST_THROW( arcp_weak1.end(), DanglingReferenceError );
843 TEST_THROW( arcp_weak1.view(0,
n), DanglingReferenceError );
844 TEST_THROW( arcp_weak1(0,
n), DanglingReferenceError );
845 TEST_THROW( arcp_weak1(), DanglingReferenceError );
846 TEST_THROW( {ArrayView<T> av = arcp_weak1();}, DanglingReferenceError );
848 DanglingReferenceError );
849 TEST_THROW( arcp_weak1.release(), DanglingReferenceError );
850 #endif // TEUCHOS_DEBUG
871 TEST_THROW( arcp_weak2.assert_valid_ptr(), DanglingReferenceError );
874 #endif // TEUCHOS_DEBUG
883 ArrayRCP<T> arcp1 = arcp<T>(
n);
887 TEST_THROW( av.size(), DanglingReferenceError );
888 TEST_THROW( av.toString(), DanglingReferenceError );
889 TEST_THROW( av.getRawPtr(), DanglingReferenceError );
891 TEST_THROW( av.front(), DanglingReferenceError );
892 TEST_THROW( av.back(), DanglingReferenceError );
893 TEST_THROW( av.view(0,
n), DanglingReferenceError );
896 TEST_THROW( av.getConst(), DanglingReferenceError );
897 TEST_THROW( av.begin(), DanglingReferenceError );
898 TEST_THROW( av.end(), DanglingReferenceError );
905 ArrayRCP<const T> cptr;
918 const T *cptr = NULL;
933 ArrayRCP<T> arcp_strong = arcp<T>(0);
940 Array<T> a = generateArray<T>(
n);
942 ArrayRCP<T> arcp1 = Teuchos::arcpFromArrayView(av);
952 TEST_THROW(ArrayRCP<T> arcp_strong = arcp<T>(-1),
959 ECHO(ArrayRCP<T> arcp1 = arcp<T>(
n));
966 TEST_THROW(arcp1.persistingView(-1,
n), RangeError);
967 TEST_THROW(arcp1.persistingView(0,
n+1), RangeError);
968 TEST_THROW(arcp1.persistingView(0,-1), RangeError);
972 #endif // TEUCHOS_DEBUG
982 # define DEBUG_UNIT_TEST_GROUP( T ) \
983 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, arcp_neg, T ) \
984 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, outOfBounds, T ) \
988 # define DEBUG_UNIT_TEST_GROUP( T )
993 #define UNIT_TEST_GROUP( T ) \
994 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, construct_n, T ) \
995 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, assignSelf, T ) \
996 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, assign_n_val, T ) \
997 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, assign_begin_end, T ) \
998 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, print_iterators, T ) \
999 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, deepCopy, T ) \
1000 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, resize, T ) \
1001 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, clear, T ) \
1002 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, nullIterator, T ) \
1003 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, implicitConversions, T ) \
1004 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, weakDelete, T ) \
1005 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, danglingArrayView, T ) \
1006 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, getRawPtr, T) \
1007 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( CPtr, getRawPtr, T) \
1008 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, arcp_zero, T ) \
1009 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( ArrayRCP, arcpFromArrayView, T ) \
1010 DEBUG_UNIT_TEST_GROUP(T)
Dangling reference error exception class.
ArrayRCP< T2 > arcp_reinterpret_cast_nonpod(const ArrayRCP< T1 > &p1, const T2 &val=T2())
Reinterpret cast of underlying ArrayRCP type from T1* to T2* where T2 is a non-POD (non-plain-old-dat...
Null reference error exception class.
RCP< T > rcp(const boost::shared_ptr< T > &sptr)
Conversion function that takes in a boost::shared_ptr object and spits out a Teuchos::RCP object...
#define TEST_ASSERT(v1)
Assert the given statement is true.
#define UNIT_TEST_GROUP(T)
#define TEST_NOTHROW(code)
Asserr that the statement 'code' does not thrown any excpetions.
#define ECHO(statement)
Echo the given statement before it is executed.
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(TEST_GROUP, TEST_NAME, TYPE)
Macro for defining a templated unit test with one template parameter.
RawPointerConversionTraits< Container >::Ptr_t getRawPtr(const Container &c)
#define TEST_EQUALITY(v1, v2)
Assert the equality of v1 and v2.
#define TEST_THROW(code, ExceptType)
Assert that the statement 'code' throws the exception 'ExceptType' (otherwise the test fails)...
const T & getConst(T &t)
Return a constant reference to an object given a non-const reference.
ArrayRCP< T > arcp(const RCP< Array< T > > &v)
Wrap an RCP<Array<T> > object as an ArrayRCP<T> object.
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
Macro for defining a (non-templated) unit test.
bool is_null(const ArrayRCP< T > &p)
Returns true if p.get()==NULL.
ArrayRCP< T2 > arcp_reinterpret_cast(const ArrayRCP< T1 > &p1)
Reinterpret cast of underlying ArrayRCP type from T1* to T2*.
#define SET_RCPNODE_TRACING()
ArrayRCP< T > arcpFromArrayView(const ArrayView< T > &av)
Get an ArrayRCP object out of an ArrayView object.
TEUCHOS_ORDINAL_TYPE Teuchos_Ordinal
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
#define TEST_EQUALITY_CONST(v1, v2)
Assert the equality of v1 and constant v2.
ArrayRCP< T > arcpCloneNode(const ArrayRCP< T > &a)
Allocate a new ArrayRCP object with a new RCPNode with memory pointing to the initial node...
TypeTo * implicit_ptr_cast(TypeFrom *t)
Perform an implicit cast of pointer types with a pointer being returned.
int size(const Comm< Ordinal > &comm)
Get the number of processes in the communicator.
Teuchos::Array< T > generateArray(const int n_in)
TypeTo as(const TypeFrom &t)
Convert from one value type to another.
Ptr< T > ptr(T *p)
Create a pointer to an object from a raw pointer.
#define TEST_COMPARE_ARRAYS(a1, a2)
Assert that a1.size()==a2.size() and a[i]==b[i], i=0....
RCP< T > rcpFromRef(T &r)
Return a non-owning weak RCP object from a raw object reference for a defined type.
Policy class for deallocator for non-owned RCPs.
ArrayRCP< T > arcpWithEmbeddedObj(T *p, typename ArrayRCP< T >::size_type lowerOffset, typename ArrayRCP< T >::size_type size, const Embedded &embedded, bool owns_mem=true)
Create an ArrayRCP with and also put in an embedded object.
Smart reference counting pointer class for automatic garbage collection.
Range error exception class.
Thrown if a duplicate owning RCP is creatd the the same object.
Reference-counted pointer class and non-member templated function implementations.
Definition of Teuchos::as, for conversions between types.
bool nonnull(const ArrayRCP< T > &p)
Returns true if p.get()!=NULL.
Reference-counted smart pointer for managing arrays.
Replacement for std::vector that is compatible with the Teuchos Memory Management classes...