$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r60290 - branches/release/libs/utility
From: daniel_james_at_[hidden]
Date: 2010-03-07 07:11:45
Author: danieljames
Date: 2010-03-07 07:11:44 EST (Sun, 07 Mar 2010)
New Revision: 60290
URL: http://svn.boost.org/trac/boost/changeset/60290
Log:
Merge some tests for unwrap ([47296], [47297])
Properties modified: 
   branches/release/libs/utility/   (props changed)
Text files modified: 
   branches/release/libs/utility/ref_test.cpp |    43 ++++++++++++++++++++++++++++++++++++++++
   1 files changed, 43 insertions(+), 0 deletions(-)
Modified: branches/release/libs/utility/ref_test.cpp
==============================================================================
--- branches/release/libs/utility/ref_test.cpp	(original)
+++ branches/release/libs/utility/ref_test.cpp	2010-03-07 07:11:44 EST (Sun, 07 Mar 2010)
@@ -68,11 +68,54 @@
     }
 };
 
+struct copy_counter {
+  static int count_;
+  copy_counter(copy_counter const& other) {
+    ++count_;
+  }
+  copy_counter() {}
+  static void reset() { count_ = 0; }
+  static int count() { return copy_counter::count_;  }
+};
+
+int copy_counter::count_ = 0;
+
 } // namespace unnamed
 
+template <class T>
+void do_unwrap(T t) {
+
+  /* typename unwrap_reference<T>::type& lt = */
+  unwrap_ref(t);
+
+}
+
+void unwrap_test() {
+
+  int i = 3;
+  const int ci = 2;
+
+  do_unwrap(i);
+  do_unwrap(ci);
+  do_unwrap(ref(i));
+  do_unwrap(cref(ci));
+  do_unwrap(ref(ci));
+
+  copy_counter cc;
+  BOOST_CHECK(cc.count() == 0);
+
+  do_unwrap(cc);
+  do_unwrap(ref(cc));
+  do_unwrap(cref(cc));
+
+  BOOST_CHECK(cc.count() == 1);
+  BOOST_CHECK(unwrap_ref(ref(cc)).count() == 1); 
+}
+
 int test_main(int, char * [])
 {
     ref_wrapper<int>::test(1);
     ref_wrapper<int const>::test(1);
+    unwrap_test();
     return 0;
 }