From 439bc0ff201f38025d224ce421c86ca44f3dc063 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 28 Feb 2012 12:46:48 +0200 Subject: Test std::shared_ptr in C++11 mode and std::tr1::shared_ptr in C++98 mode --- common/lazy-ptr/test.hxx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'common/lazy-ptr/test.hxx') diff --git a/common/lazy-ptr/test.hxx b/common/lazy-ptr/test.hxx index f9362f8..0adddf8 100644 --- a/common/lazy-ptr/test.hxx +++ b/common/lazy-ptr/test.hxx @@ -5,7 +5,7 @@ #ifndef TEST_HXX #define TEST_HXX -#include // HAVE_TR1_MEMORY +#include // HAVE_CXX11, HAVE_TR1_MEMORY #include #include @@ -14,7 +14,7 @@ #include #include -#ifdef HAVE_TR1_MEMORY +#if !defined(HAVE_CXX11) && defined(HAVE_TR1_MEMORY) # include # include #endif @@ -59,8 +59,8 @@ inline cont1:: ~cont1 () { for (obj_list::iterator i (o.begin ()); i != o.end (); ++i) - if (i->loaded ()) - delete i->get (); + if (obj1* p = i->get ()) + delete p; } // Auto pointer. @@ -98,14 +98,20 @@ public: lazy_ptr c; // weak }; -// TR1. +// shared_ptr // -#ifdef HAVE_TR1_MEMORY -namespace tr1 +#if defined(HAVE_CXX11) || defined(HAVE_TR1_MEMORY) +namespace shared { +#ifdef HAVE_CXX11 + using std::shared_ptr; + using odb::lazy_shared_ptr; + using odb::lazy_weak_ptr; +#else using std::tr1::shared_ptr; using odb::tr1::lazy_shared_ptr; using odb::tr1::lazy_weak_ptr; +#endif class obj; -- cgit v1.1