$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r50520 - in sandbox/unique_ptr: . unique.ptr unique.ptr/unique.ptr.dltr unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1 unique.ptr/unique.ptr.runtime unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers unique.ptr/unique.ptr.single unique.ptr/unique.ptr.single/unique.ptr.single.asgn unique.ptr/unique.ptr.single/unique.ptr.single.ctor unique.ptr/unique.ptr.single/unique.ptr.single.dtor unique.ptr/unique.ptr.single/unique.ptr.single.modifiers unique.ptr/unique.ptr.single/unique.ptr.single.observers
From: steven_at_[hidden]
Date: 2009-01-08 15:36:31
Author: steven_watanabe
Date: 2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
New Revision: 50520
URL: http://svn.boost.org/trac/boost/changeset/50520
Log:
Add unique_ptr C++03 emulation
Added:
   sandbox/unique_ptr/
   sandbox/unique_ptr/Jamroot.jam   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/
   sandbox/unique_ptr/unique.ptr/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/forward01.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/forward01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/forward02.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/forward02.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/forward03.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/forward03.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/move01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/move02.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/test   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/test   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/test   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/test   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move01.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move02.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move03.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move04.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/test   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/test   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/test   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/test   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/pointer_type.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/test   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/test   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter01.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter02.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter03.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter05.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/test   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/null.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/test   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/release.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset1.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset2.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/swap.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/test   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/Jamfile.v2   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp   (contents, props changed)
   sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/test   (contents, props changed)
   sandbox/unique_ptr/unique_ptr.hpp   (contents, props changed)
Added: sandbox/unique_ptr/Jamroot.jam
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/Jamroot.jam	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,59 @@
+# Jamroot.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+import path ;
+
+BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
+if ! $(BOOST_ROOT)
+{
+   EXIT "error: BOOST_ROOT not set" ;
+}
+BOOST_ROOT = [ path.root [ path.make $(BOOST_ROOT) ] [ path.pwd ] ] ;
+
+project unique_ptr
+  :
+    requirements <include>. <include>$(BOOST_ROOT)
+  :
+    build-dir bin
+;
+
+rule create-targets ( )
+{
+    import path ;
+    import regex ;
+    import project ;
+
+    local pass = [ glob "*.pass.cpp" ] ;
+    local fail = [ glob "*.fail.cpp" ] ;
+
+    for p in $(pass)
+    {
+        run $(p) ;
+    }
+
+    for f in $(fail)
+    {
+        compile-fail $(f) ;
+    }
+
+    local current-project = [ project.current ] ;
+    local project-module = [ $(current-project).project-module ] ;
+    local subprojects = [ glob "*/Jamfile.v2" ] ;
+    for local s in $(subprojects)
+    {
+        s = [ regex.match "([^/]*)/Jamfile.v2" : $(s) ] ;
+        modules.poke $(project-module) : next-project : $(s) ;
+        module $(project-module)
+        {
+            build-project $(next-project) ;
+        }
+    }
+}
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/forward01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/forward01.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,18 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr]
+// Test namespace scope move functions
+
+// forward(lvalue int) should not work (must supply template arg)
+
+#include "unique_ptr.hpp"
+
+int main()
+{
+    int i = 1;
+    int j = boost::forward(i);
+}
Added: sandbox/unique_ptr/unique.ptr/forward01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/forward01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,20 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr]
+// Test namespace scope move functions
+
+// forward<int>(lvalue int) should work
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+int main()
+{
+    int i = 1;
+    int j = boost::forward<int>(i);
+    assert(i == j);
+}
Added: sandbox/unique_ptr/unique.ptr/forward02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/forward02.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,17 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr]
+// Test namespace scope move functions
+
+// forward(rvalue int) should not work (must supply template arg)
+
+#include "unique_ptr.hpp"
+
+int main()
+{
+    int j = boost::forward(1);
+}
Added: sandbox/unique_ptr/unique.ptr/forward02.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/forward02.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,19 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr]
+// Test namespace scope move functions
+
+// forward<int>(rvalue int) should work
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+int main()
+{
+    int j = boost::forward<int>(1);
+    assert(j == 1);
+}
Added: sandbox/unique_ptr/unique.ptr/forward03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/forward03.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,17 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr]
+// Test namespace scope move functions
+
+// forward<int&>(rvalue int) should not work
+
+#include "unique_ptr.hpp"
+
+int main()
+{
+    int j = boost::forward<int&>(1);
+}
Added: sandbox/unique_ptr/unique.ptr/forward03.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/forward03.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,20 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr]
+// Test namespace scope move functions
+
+// forward<int&>(lvalue int) should work
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+int main()
+{
+    int i = 1;
+    int& j = boost::forward<int&>(i);
+    assert(j == 1);
+}
Added: sandbox/unique_ptr/unique.ptr/move01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/move01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,20 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr]
+// Test namespace scope move functions
+
+// move(lvalue int) should work
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+int main()
+{
+    int i = 1;
+    int j = boost::move(i);
+    assert(i == j);
+}
Added: sandbox/unique_ptr/unique.ptr/move02.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/move02.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,19 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr]
+// Test namespace scope move functions
+
+// move(rvalue int) should work
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+int main()
+{
+    int j = boost::move(1);
+    assert(j == 1);
+}
Added: sandbox/unique_ptr/unique.ptr/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,79 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+if [ -z $CC ]
+then
+    echo "Please export CC"
+    exit 1
+fi
+
+if [ -z $BOOST_INCLUDE ]
+then
+    echo "Please export BOOST_INCLUDE"
+    exit 1
+fi
+
+if [ -z $SOURCE_INCLUDE ]
+then
+    echo "Please export SOURCE_INCLUDE"
+    exit 1
+fi
+
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,79 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+if [ -z $CC ]
+then
+    echo "Please export CC"
+    exit 1
+fi
+
+if [ -z $BOOST_INCLUDE ]
+then
+    echo "Please export BOOST_INCLUDE"
+    exit 1
+fi
+
+if [ -z $SOURCE_INCLUDE ]
+then
+    echo "Please export SOURCE_INCLUDE"
+    exit 1
+fi
+
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,45 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.dltr.dflt]
+//
+// Test that default_delete has a working converting constructor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    boost::default_delete<B> d2;
+    boost::default_delete<A> d1 = d2;
+    A* p = new B;
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d1(p);
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,31 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.dltr.dflt]
+//
+// Test that default_delete has a working default constructor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    boost::default_delete<A> d;
+    A* p = new A;
+    assert(A::count == 1);
+    d(p);
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,21 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.dltr.dflt]
+//
+// Test that default_delete's operator() requires a complete type
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A;
+
+int main()
+{
+    boost::default_delete<A> d;
+    A* p = 0;
+    d(p);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,79 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+if [ -z $CC ]
+then
+    echo "Please export CC"
+    exit 1
+fi
+
+if [ -z $BOOST_INCLUDE ]
+then
+    echo "Please export BOOST_INCLUDE"
+    exit 1
+fi
+
+if [ -z $SOURCE_INCLUDE ]
+then
+    echo "Please export SOURCE_INCLUDE"
+    exit 1
+fi
+
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,27 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.dltr.dflt1]
+//
+// Test that default_delete<T[]> does not have a working converting constructor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+};
+
+struct B
+    : public A
+{
+};
+
+int main()
+{
+    boost::default_delete<B[]> d2;
+    boost::default_delete<A[]> d1 = d2;
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,31 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.dltr.dflt1]
+//
+// Test that default_delete<T[]> has a working default constructor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    boost::default_delete<A[]> d;
+    A* p = new A[3];
+    assert(A::count == 3);
+    d(p);
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,21 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.dltr.dflt1]
+//
+// Test that default_delete<T[]>'s operator() requires a complete type
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A;
+
+int main()
+{
+    boost::default_delete<A[]> d;
+    A* p = 0;
+    d(p);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,79 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+if [ -z $CC ]
+then
+    echo "Please export CC"
+    exit 1
+fi
+
+if [ -z $BOOST_INCLUDE ]
+then
+    echo "Please export BOOST_INCLUDE"
+    exit 1
+fi
+
+if [ -z $SOURCE_INCLUDE ]
+then
+    echo "Please export SOURCE_INCLUDE"
+    exit 1
+fi
+
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move01.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,32 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't copy from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<A> s(new A);
+    boost::unique_ptr<A> s2;
+    s2 = s;
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,91 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move assignment.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+    explicit Deleter(int i) : state_(i) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<A> s1(new A);
+    A* p = s1.get();
+    boost::unique_ptr<A> s2(new A);
+    assert(A::count == 2);
+    s2 = boost::move(s1);
+    assert(A::count == 1);
+    assert(s2.get() == p);
+    assert(s1.get() == 0);
+    }
+    assert(A::count == 0);
+    {
+    boost::unique_ptr<A, Deleter> s1(new A);
+    A* p = s1.get();
+    boost::unique_ptr<A, Deleter> s2(new A);
+    assert(A::count == 2);
+    s2 = boost::move(s1);
+    assert(s2.get() == p);
+    assert(s1.get() == 0);
+    assert(A::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s1.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    {
+    Deleter d1(5);
+    boost::unique_ptr<A, Deleter&> s1(new A, d1);
+    A* p = s1.get();
+    Deleter d2(6);
+    boost::unique_ptr<A, Deleter&> s2(new A, d2);
+    s2 = boost::move(s1);
+    assert(s2.get() == p);
+    assert(s1.get() == 0);
+    assert(A::count == 1);
+    assert(d1.state() == 0);
+    assert(d2.state() == 5);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move02.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,32 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't copy from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    const boost::unique_ptr<A> s(new A);
+    boost::unique_ptr<A> s2;
+    s2 = s;
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move03.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,50 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't copy from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<A, Deleter> s(new A);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move04.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move04.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,50 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Can't copy from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    const boost::unique_ptr<A, Deleter> s(new A);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,50 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't assign from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[]> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,88 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't assign from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    template <class U>
+        Deleter& operator=(Deleter<U> d)
+        {
+            state_ = d.state();
+            return *this;
+        }
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<B[], Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter<A> > s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,94 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't assign from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+    explicit Deleter(int i) : state_(i) {}
+
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename boost::enable_if_c
+            <
+                boost::detail::is_convertible<U, T>::value
+            >::type* = 0)
+            : state_(d.state()) {}
+
+    template <class U>
+        Deleter& operator=(Deleter<U> d)
+        {
+            state_ = d.state();
+            return *this;
+        }
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    Deleter<B> db(5);
+    boost::unique_ptr<B[], Deleter<B>&> s(new B, db);
+    A* p = s.get();
+    Deleter<A> da(6);
+    boost::unique_ptr<A[], Deleter<A>&> s2(new A, da);
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,50 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't assign from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const boost::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[]> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,88 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't assign from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    template <class U>
+        Deleter& operator=(Deleter<U> d)
+        {
+            state_ = d.state();
+            return *this;
+        }
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    const boost::unique_ptr<B[], Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter<A> > s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,94 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't assign from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+    explicit Deleter(int i) : state_(i) {}
+
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename boost::enable_if_c
+            <
+                boost::detail::is_convertible<U, T>::value
+            >::type* = 0)
+            : state_(d.state()) {}
+
+    template <class U>
+        Deleter& operator=(Deleter<U> d)
+        {
+            state_ = d.state();
+            return *this;
+        }
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    Deleter<B> db(5);
+    const boost::unique_ptr<B[], Deleter<B>&> s(new B, db);
+    A* p = s.get();
+    Deleter<A> da(6);
+    boost::unique_ptr<A[], Deleter<A>&> s2(new A, da);
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,49 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[]> s2(new A);
+    assert(A::count == 2);
+    s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,91 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename boost::enable_if_c
+            <
+                boost::detail::is_convertible<U, T>::value
+            >::type* = 0)
+            : state_(d.state()) {}
+
+    template <class U>
+        Deleter& operator=(Deleter<U> d)
+        {
+            state_ = d.state();
+            return *this;
+        }
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<B[], Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter<A> > s2(new A);
+    assert(A::count == 2);
+    s2 = (boost::move(s));
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,94 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move assignment with reference deleters
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+    explicit Deleter(int i) : state_(i) {}
+
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename boost::enable_if_c
+            <
+                boost::detail::is_convertible<U, T>::value
+            >::type* = 0)
+            : state_(d.state()) {}
+
+    template <class U>
+        Deleter& operator=(Deleter<U> d)
+        {
+            state_ = d.state();
+            return *this;
+        }
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    Deleter<B> db(5);
+    boost::unique_ptr<B[], Deleter<B>&> s(new B, db);
+    A* p = s.get();
+    Deleter<A> da(6);
+    boost::unique_ptr<A[], Deleter<A>&> s2(new A, da);
+    s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,35 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test assignment from null
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<A> s2(new A);
+    assert(A::count == 1);
+    s2 = 0;
+    assert(A::count == 0);
+    assert(s2.get() == 0);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,39 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime]
+// The deleter is not called if get() == 0
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(0) {}
+
+    int state() const {return state_;}
+
+    void operator()(void*) {++state_;}
+};
+
+
+int main()
+{
+    Deleter d;
+    assert(d.state() == 0);
+    {
+    boost::unique_ptr<int[], Deleter&> p(0, d);
+    assert(p.get() == 0);
+    assert(&p.get_deleter() == &d);
+    }
+    assert(d.state() == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,31 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime]
+// Test unique_ptr<T[]>::pointer type
+
+#include "unique_ptr.hpp"
+#include <boost/type_traits.hpp>
+#include <boost/static_assert.hpp>
+
+struct Deleter
+{
+    struct pointer {};
+};
+
+int main()
+{
+    {
+    typedef boost::unique_ptr<int[]> P;
+    using namespace boost;
+    BOOST_STATIC_ASSERT((is_same<P::pointer, int*>::value));
+    }
+    {
+    typedef boost::unique_ptr<int[], Deleter> P;
+    using namespace boost;
+    BOOST_STATIC_ASSERT((is_same<P::pointer, Deleter::pointer>::value));
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+CC=g++
+BOOST_INCLUDE="-I/Users/hinnant/Development/boost-dev/boost-trunk"
+SOURCE_INCLUDE="-I/Users/hinnant/Development/unique_ptr"
+OPTIONS=""
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,30 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr default ctor
+
+#include "unique_ptr.hpp"
+
+// default unique_ptr ctor should require default Deleter ctor
+class Deleter
+{
+
+    Deleter() {}
+
+public:
+
+    Deleter(Deleter&) {}
+    Deleter& operator=(Deleter&) {}
+
+    void operator()(void*) const {}
+};
+
+
+int main()
+{
+    boost::unique_ptr<int[], Deleter> p;
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,41 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr default ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// default unique_ptr ctor should only require default Deleter ctor
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(void*) {}
+};
+
+
+int main()
+{
+    {
+    boost::unique_ptr<int[]> p;
+    assert(p.get() == 0);
+    }
+    {
+    boost::unique_ptr<int[], Deleter> p;
+    assert(p.get() == 0);
+    assert(p.get_deleter().state() == 5);
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,24 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr default ctor
+
+#include "unique_ptr.hpp"
+
+// default unique_ptr ctor should require non-reference Deleter ctor
+class Deleter
+{
+public:
+
+    void operator()(void*) {}
+};
+
+
+int main()
+{
+    boost::unique_ptr<int[], Deleter&> p;
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,78 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test default unique_ptr<T[]> ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// default unique_ptr<T[]> ctor shouldn't require complete type
+
+struct A;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p);
+};
+
+void check(int i);
+
+template <class D = boost::default_delete<A> >
+struct B
+{
+    boost::unique_ptr<A[], D> a_;
+    B() {}
+    ~B();
+
+    A* get() const {return a_.get();}
+    D& get_deleter() {return a_.get_deleter();}
+};
+
+int main()
+{
+    {
+    B<> s;
+    assert(s.get() == 0);
+    }
+    check(0);
+    {
+    B<Deleter> s;
+    assert(s.get() == 0);
+    assert(s.get_deleter().state() == 5);
+    }
+    check(0);
+}
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+void Deleter::operator()(A* p) {delete p;}
+
+void check(int i)
+{
+    assert(A::count == i);
+}
+
+template <class D>
+B<D>::~B() {}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,17 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr default ctor
+
+#include "unique_ptr.hpp"
+
+// default unique_ptr ctor should require non-pointer Deleter
+
+int main()
+{
+    boost::unique_ptr<int[], void (*)(void*)> p;
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,36 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Can't copy from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<A[]> s(new A[3]);
+    A* p = s.get();
+    boost::unique_ptr<A[]> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,101 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<A[]> s(new A[3]);
+    A* p = s.get();
+    boost::unique_ptr<A[]> s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 3);
+    }
+    assert(A::count == 0);
+    {
+    boost::unique_ptr<A[], Deleter> s(new A[3]);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter> s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 3);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    {
+    CDeleter d;
+    boost::unique_ptr<A[], CDeleter&> s(new A[3], d);
+    A* p = s.get();
+    boost::unique_ptr<A[], CDeleter&> s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 3);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,36 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Can't copy from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    const boost::unique_ptr<A[]> s(new A[3]);
+    A* p = s.get();
+    boost::unique_ptr<A[]> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,103 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+boost::unique_ptr<A[]>
+source1()
+{
+    return boost::unique_ptr<A[]>(new A[3]);
+}
+
+void sink1(boost::unique_ptr<A[]> p)
+{
+}
+
+boost::unique_ptr<A[], Deleter>
+source2()
+{
+    return boost::unique_ptr<A[], Deleter>(new A[3]);
+}
+
+void sink2(boost::unique_ptr<A[], Deleter> p)
+{
+}
+
+boost::unique_ptr<A[], CDeleter&>
+source3()
+{
+    static CDeleter d;
+    return boost::unique_ptr<A[], CDeleter&>(new A[3], d);
+}
+
+void sink3(boost::unique_ptr<A[], CDeleter&> p)
+{
+}
+
+int main()
+{
+    sink1(source1());
+    sink2(source2());
+    sink3(source3());
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,49 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Can't copy from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<A[], Deleter> s(new A[3]);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,49 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Can't copy from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+int main()
+{
+    {
+    const boost::unique_ptr<A[], Deleter> s(new A[3]);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,51 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[]> s2(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,82 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<B[], Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter<A> > s2(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,72 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    boost::unique_ptr<B[], CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    boost::unique_ptr<A[], CDeleter<A>&> s2(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,51 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[]> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,82 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<B[], Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter<A> > s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,72 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    boost::unique_ptr<B[], CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    boost::unique_ptr<A[], CDeleter<A>&> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,51 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const boost::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[]> s2(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,82 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    const boost::unique_ptr<B[], Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter<A> > s2(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,72 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    const boost::unique_ptr<B[], CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    boost::unique_ptr<A[], CDeleter<A>&> s2(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,51 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const boost::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[]> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,82 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    const boost::unique_ptr<B[], Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter<A> > s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,72 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    const boost::unique_ptr<B[], CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    boost::unique_ptr<A[], CDeleter<A>&> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,51 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[]> s2(boost::move(s));
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,82 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<B[], Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter<A> > s2(boost::move(s));
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,72 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    boost::unique_ptr<B[], CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    boost::unique_ptr<A[], CDeleter<A>&> s2(boost::move(s));
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,51 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[]> s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,82 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<B[], Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter<A> > s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,72 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    boost::unique_ptr<B, CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    boost::unique_ptr<A, CDeleter<A>&> s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,30 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr<T[]>(pointer) ctor
+
+#include "unique_ptr.hpp"
+
+// unique_ptr<T[]>(pointer) ctor should require default Deleter ctor
+class Deleter
+{
+
+    Deleter() {}
+
+public:
+
+    Deleter(Deleter&) {}
+    Deleter& operator=(Deleter&) {}
+
+    void operator()(void*) const {}
+};
+
+
+int main()
+{
+    boost::unique_ptr<int[], Deleter> p(new int);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,57 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr(pointer) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr<T[]>(pointer) ctor should only require default Deleter ctor
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+int main()
+{
+    {
+    A* p = new A[3];
+    assert(A::count == 3);
+    boost::unique_ptr<A[]> s(p);
+    assert(s.get() == p);
+    }
+    assert(A::count == 0);
+    {
+    A* p = new A[3];
+    assert(A::count == 3);
+    boost::unique_ptr<A[], Deleter> s(p);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,24 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr<T[]>(pointer) ctor
+
+#include "unique_ptr.hpp"
+
+// unique_ptr<T[]>(pointer) ctor should require non-reference Deleter ctor
+class Deleter
+{
+public:
+
+    void operator()(void*) {}
+};
+
+
+int main()
+{
+    boost::unique_ptr<int[], Deleter&> p(new int);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,89 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr<T[]>(pointer) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr<T[]>(pointer) ctor shouldn't require complete type
+
+struct A;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p);
+};
+
+void check(int i);
+
+template <class D = boost::default_delete<A[]> >
+struct B
+{
+    boost::unique_ptr<A[], D> a_;
+    explicit B(A*);
+    ~B();
+
+    A* get() const {return a_.get();}
+    D& get_deleter() {return a_.get_deleter();}
+};
+
+A* get();
+
+int main()
+{
+    {
+    A* p = get();
+    check(3);
+    B<> s(p);
+    assert(s.get() == p);
+    }
+    check(0);
+    {
+    A* p = get();
+    check(3);
+    B<Deleter> s(p);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    check(0);
+}
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+A* get() {return new A[3];}
+
+void Deleter::operator()(A* p) {delete [] p;}
+
+void check(int i)
+{
+    assert(A::count == i);
+}
+
+template <class D>
+B<D>::B(A* a) : a_(a) {}
+
+template <class D>
+B<D>::~B() {}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,17 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr<T[]>(pointer) ctor
+
+#include "unique_ptr.hpp"
+
+// unique_ptr<T[]>(pointer) ctor should require non-pointer Deleter
+
+int main()
+{
+    boost::unique_ptr<int[], void (*)(void*)> p(new int);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,61 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr(pointer) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr(pointer) ctor should not work with derived pointers
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+int main()
+{
+    {
+    B* p = new B[3];
+    boost::unique_ptr<A[]> s(p);
+    }
+    {
+    B* p = new B[3];
+    boost::unique_ptr<A[], Deleter> s(p);
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,53 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr(pointer, deleter) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr(pointer, deleter()) only requires MoveConstructible deleter
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+int main()
+{
+    {
+    A* p = new A[3];
+    assert(A::count == 3);
+    boost::unique_ptr<A[], Deleter> s(p, Deleter());
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,52 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr(pointer, deleter) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr(pointer, d) requires CopyConstructible deleter
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+int main()
+{
+    {
+    A* p = new A[3];
+    assert(A::count == 3);
+    Deleter d;
+    boost::unique_ptr<A[], Deleter> s(p, d);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    d.set_state(6);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,54 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr(pointer, deleter) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr<T[], D&>(pointer, d) does not requires CopyConstructible deleter
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(const Deleter&);
+    Deleter& operator=(const Deleter&);
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+int main()
+{
+    {
+    A* p = new A[3];
+    assert(A::count == 3);
+    Deleter d;
+    boost::unique_ptr<A[], Deleter&> s(p, d);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    d.set_state(6);
+    assert(s.get_deleter().state() == 6);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,49 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr(pointer, deleter) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr<T, const D&>(pointer, D()) should not compile
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) const {delete [] p;}
+};
+
+int main()
+{
+    {
+    A* p = new A[3];
+    assert(A::count == 3);
+    boost::unique_ptr<A[], const Deleter&> s(p, Deleter());
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,52 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr(pointer, deleter) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr<T[], const D&>(pointer, d) does not requires CopyConstructible deleter
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(const Deleter&);
+    Deleter& operator=(const Deleter&);
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) const {delete [] p;}
+};
+
+int main()
+{
+    {
+    A* p = new A[3];
+    assert(A::count == 3);
+    Deleter d;
+    boost::unique_ptr<A[], const Deleter&> s(p, d);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,52 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr(pointer, deleter) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr(pointer, deleter) should not work with derived pointers
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+int main()
+{
+    B* p = new B[3];
+    boost::unique_ptr<A[], Deleter> s(p, Deleter());
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+CC=g++
+BOOST_INCLUDE="-I/Users/hinnant/Development/boost-dev/boost-trunk"
+SOURCE_INCLUDE="-I/Users/hinnant/Development/unique_ptr"
+OPTIONS=""
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,20 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.modifiers]
+// test release
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+int main()
+{
+    boost::unique_ptr<int[]> p(new int[3]);
+    int* i = p.get();
+    int* j = p.release();
+    assert(p.get() == 0);
+    assert(i == j);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,42 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.modifiers]
+// test reset
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<A[]> p(new A[3]);
+    assert(A::count == 3);
+    A* i = p.get();
+    p.reset();
+    assert(A::count == 0);
+    assert(p.get() == 0);
+    }
+    assert(A::count == 0);
+    {
+    boost::unique_ptr<A[]> p(new A[4]);
+    assert(A::count == 4);
+    A* i = p.get();
+    p.reset(new A[5]);
+    assert(A::count == 5);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,58 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.modifiers]
+// test reset
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<A[]> p(new A);
+    assert(A::count == 1);
+    assert(B::count == 0);
+    A* i = p.get();
+    p.reset(new B);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+    {
+    boost::unique_ptr<A[]> p(new B);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    A* i = p.get();
+    p.reset(new B);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,84 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.modifiers]
+// test swap
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    int state_;
+    static int count;
+    A() : state_(0) {++count;}
+    explicit A(int i) : state_(i) {++count;}
+    A(const A& a) : state_(a.state_) {++count;}
+    A& operator=(const A& a) {state_ = a.state_; return *this;}
+    ~A() {--count;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.state_ == y.state_;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(0) {}
+    explicit Deleter(int i) : state_(i) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete [] p;}
+
+    friend bool operator==(const Deleter& x, const Deleter& y)
+        {return x.state_ == y.state_;}
+};
+
+void
+swap(Deleter& x, Deleter& y)
+{
+    Deleter t(boost::move(x));
+    x = boost::move(y);
+    y = boost::move(t);
+}
+
+int main()
+{
+    {
+    A* p1 = new A[3];
+    boost::unique_ptr<A[], Deleter> s1(p1, Deleter(1));
+    A* p2 = new A[3];
+    boost::unique_ptr<A[], Deleter> s2(p2, Deleter(2));
+    assert(s1.get() == p1);
+    assert(s1.get_deleter().state() == 1);
+    assert(s2.get() == p2);
+    assert(s2.get_deleter().state() == 2);
+    swap(s1, s2);
+    assert(s1.get() == p2);
+    assert(s1.get_deleter().state() == 2);
+    assert(s2.get() == p1);
+    assert(s2.get_deleter().state() == 1);
+    assert(A::count == 6);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+CC=g++
+BOOST_INCLUDE="-I/Users/hinnant/Development/boost-dev/boost-trunk"
+SOURCE_INCLUDE="-I/Users/hinnant/Development/unique_ptr"
+OPTIONS=""
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,17 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.observers]
+// test op*()
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+int main()
+{
+    boost::unique_ptr<int[]> p(new int(3));
+    assert(*p == 3);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,33 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.observers]
+// test op*()
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+int main()
+{
+    {
+    boost::unique_ptr<int[]> p(new int [3]);
+    if (p)
+        ;
+    else
+        assert(false);
+    if (!p)
+        assert(false);
+    }
+    {
+    boost::unique_ptr<int[]> p;
+    if (!p)
+        ;
+    else
+        assert(false);
+    if (p)
+        assert(false);
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,18 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.observers]
+// test get
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+int main()
+{
+    int* p = new int[3];
+    boost::unique_ptr<int[]> s(p);
+    assert(s.get() == p);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,31 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.observers]
+// test get_deleter()
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct Deleter
+{
+    void operator()(void*) {}
+
+    int test() {return 5;}
+    int test() const {return 6;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<int[], Deleter> p;
+    assert(p.get_deleter().test() == 5);
+    }
+    {
+    const boost::unique_ptr<int[], Deleter> p;
+    assert(p.get_deleter().test() == 6);
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,41 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.observers]
+// test op[](size_t)
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+class A
+{
+    int state_;
+    static int next_;
+public:
+    A() : state_(++next_) {}
+    int get() const {return state_;}
+
+    friend bool operator==(const A& x, int y)
+        {return x.state_ == y;}
+
+    A& operator=(int i) {state_ = i; return *this;}
+};
+
+int A::next_ = 0;
+
+int main()
+{
+    boost::unique_ptr<A[]> p(new A[3]);
+    assert(p[0] == 1);
+    assert(p[1] == 2);
+    assert(p[2] == 3);
+    p[0] = 3;
+    p[1] = 2;
+    p[2] = 1;
+    assert(p[0] == 3);
+    assert(p[1] == 2);
+    assert(p[2] == 1);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,24 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.observers]
+// test op->()
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    int i_;
+
+    A() : i_(7) {}
+};
+
+int main()
+{
+    boost::unique_ptr<A[]> p(new A);
+    assert(p->i_ == 7);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+CC=g++
+BOOST_INCLUDE="-I/Users/hinnant/Development/boost-dev/boost-trunk"
+SOURCE_INCLUDE="-I/Users/hinnant/Development/unique_ptr"
+OPTIONS=""
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/pointer_type.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,31 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single]
+// Test unique_ptr::pointer type
+
+#include "unique_ptr.hpp"
+#include <boost/type_traits.hpp>
+#include <boost/static_assert.hpp>
+
+struct Deleter
+{
+    struct pointer {};
+};
+
+int main()
+{
+    {
+    typedef boost::unique_ptr<int> P;
+    using namespace boost;
+    BOOST_STATIC_ASSERT((is_same<P::pointer, int*>::value));
+    }
+    {
+    typedef boost::unique_ptr<int, Deleter> P;
+    using namespace boost;
+    BOOST_STATIC_ASSERT((is_same<P::pointer, Deleter::pointer>::value));
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+CC=g++
+BOOST_INCLUDE="-I/Users/hinnant/Development/boost-dev/boost-trunk"
+SOURCE_INCLUDE="-I/Users/hinnant/Development/unique_ptr"
+OPTIONS=""
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,32 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't copy from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<A> s(new A);
+    boost::unique_ptr<A> s2;
+    s2 = s;
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,91 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move assignment.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+    explicit Deleter(int i) : state_(i) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<A> s1(new A);
+    A* p = s1.get();
+    boost::unique_ptr<A> s2(new A);
+    assert(A::count == 2);
+    s2 = boost::move(s1);
+    assert(A::count == 1);
+    assert(s2.get() == p);
+    assert(s1.get() == 0);
+    }
+    assert(A::count == 0);
+    {
+    boost::unique_ptr<A, Deleter> s1(new A);
+    A* p = s1.get();
+    boost::unique_ptr<A, Deleter> s2(new A);
+    assert(A::count == 2);
+    s2 = boost::move(s1);
+    assert(s2.get() == p);
+    assert(s1.get() == 0);
+    assert(A::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s1.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    {
+    Deleter d1(5);
+    boost::unique_ptr<A, Deleter&> s1(new A, d1);
+    A* p = s1.get();
+    Deleter d2(6);
+    boost::unique_ptr<A, Deleter&> s2(new A, d2);
+    s2 = boost::move(s1);
+    assert(s2.get() == p);
+    assert(s1.get() == 0);
+    assert(A::count == 1);
+    assert(d1.state() == 0);
+    assert(d2.state() == 5);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,32 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't copy from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    const boost::unique_ptr<A> s(new A);
+    boost::unique_ptr<A> s2;
+    s2 = s;
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,50 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't copy from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<A, Deleter> s(new A);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,50 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Can't copy from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    const boost::unique_ptr<A, Deleter> s(new A);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,50 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't assign from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,49 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A> s2(new A);
+    assert(A::count == 2);
+    s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,88 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't assign from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    template <class U>
+        Deleter& operator=(Deleter<U> d)
+        {
+            state_ = d.state();
+            return *this;
+        }
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter<A> > s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,91 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename boost::enable_if_c
+            <
+                boost::detail::is_convertible<U, T>::value
+            >::type* = 0)
+            : state_(d.state()) {}
+
+    template <class U>
+        Deleter& operator=(Deleter<U> d)
+        {
+            state_ = d.state();
+            return *this;
+        }
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter<A> > s2(new A);
+    assert(A::count == 2);
+    s2 = (boost::move(s));
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,94 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't assign from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+    explicit Deleter(int i) : state_(i) {}
+
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename boost::enable_if_c
+            <
+                boost::detail::is_convertible<U, T>::value
+            >::type* = 0)
+            : state_(d.state()) {}
+
+    template <class U>
+        Deleter& operator=(Deleter<U> d)
+        {
+            state_ = d.state();
+            return *this;
+        }
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    Deleter<B> db(5);
+    boost::unique_ptr<B, Deleter<B>&> s(new B, db);
+    A* p = s.get();
+    Deleter<A> da(6);
+    boost::unique_ptr<A, Deleter<A>&> s2(new A, da);
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,94 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move assignment with reference deleters
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+    explicit Deleter(int i) : state_(i) {}
+
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename boost::enable_if_c
+            <
+                boost::detail::is_convertible<U, T>::value
+            >::type* = 0)
+            : state_(d.state()) {}
+
+    template <class U>
+        Deleter& operator=(Deleter<U> d)
+        {
+            state_ = d.state();
+            return *this;
+        }
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    Deleter<B> db(5);
+    boost::unique_ptr<B, Deleter<B>&> s(new B, db);
+    A* p = s.get();
+    Deleter<A> da(6);
+    boost::unique_ptr<A, Deleter<A>&> s2(new A, da);
+    s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,50 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't assign from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const boost::unique_ptr<B> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,88 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't assign from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    template <class U>
+        Deleter& operator=(Deleter<U> d)
+        {
+            state_ = d.state();
+            return *this;
+        }
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    const boost::unique_ptr<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter<A> > s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,94 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr converting move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't assign from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+    explicit Deleter(int i) : state_(i) {}
+
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename boost::enable_if_c
+            <
+                boost::detail::is_convertible<U, T>::value
+            >::type* = 0)
+            : state_(d.state()) {}
+
+    template <class U>
+        Deleter& operator=(Deleter<U> d)
+        {
+            state_ = d.state();
+            return *this;
+        }
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    Deleter<B> db(5);
+    const boost::unique_ptr<B, Deleter<B>&> s(new B, db);
+    A* p = s.get();
+    Deleter<A> da(6);
+    boost::unique_ptr<A, Deleter<A>&> s2(new A, da);
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,35 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.asgn]
+// Test unique_ptr move assignment
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test assignment from null
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<A> s2(new A);
+    assert(A::count == 1);
+    s2 = 0;
+    assert(A::count == 0);
+    assert(s2.get() == 0);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+CC=g++
+BOOST_INCLUDE="-I/Users/hinnant/Development/boost-dev/boost-trunk"
+SOURCE_INCLUDE="-I/Users/hinnant/Development/unique_ptr"
+OPTIONS=""
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,30 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr default ctor
+
+#include "unique_ptr.hpp"
+
+// default unique_ptr ctor should require default Deleter ctor
+class Deleter
+{
+
+    Deleter() {}
+
+public:
+
+    Deleter(Deleter&) {}
+    Deleter& operator=(Deleter&) {}
+
+    void operator()(void*) const {}
+};
+
+
+int main()
+{
+    boost::unique_ptr<int, Deleter> p;
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,41 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr default ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// default unique_ptr ctor should only require default Deleter ctor
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(void*) {}
+};
+
+
+int main()
+{
+    {
+    boost::unique_ptr<int> p;
+    assert(p.get() == 0);
+    }
+    {
+    boost::unique_ptr<int, Deleter> p;
+    assert(p.get() == 0);
+    assert(p.get_deleter().state() == 5);
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,24 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr default ctor
+
+#include "unique_ptr.hpp"
+
+// default unique_ptr ctor should require non-reference Deleter ctor
+class Deleter
+{
+public:
+
+    void operator()(void*) {}
+};
+
+
+int main()
+{
+    boost::unique_ptr<int, Deleter&> p;
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,78 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test default unique_ptr ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// default unique_ptr ctor shouldn't require complete type
+
+struct A;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p);
+};
+
+void check(int i);
+
+template <class D = boost::default_delete<A> >
+struct B
+{
+    boost::unique_ptr<A, D> a_;
+    B() {}
+    ~B();
+
+    A* get() const {return a_.get();}
+    D& get_deleter() {return a_.get_deleter();}
+};
+
+int main()
+{
+    {
+    B<> s;
+    assert(s.get() == 0);
+    }
+    check(0);
+    {
+    B<Deleter> s;
+    assert(s.get() == 0);
+    assert(s.get_deleter().state() == 5);
+    }
+    check(0);
+}
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+void Deleter::operator()(A* p) {delete p;}
+
+void check(int i)
+{
+    assert(A::count == i);
+}
+
+template <class D>
+B<D>::~B() {}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,17 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr default ctor
+
+#include "unique_ptr.hpp"
+
+// default unique_ptr ctor should require non-pointer Deleter
+
+int main()
+{
+    boost::unique_ptr<int, void (*)(void*)> p;
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,36 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Can't copy from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<A> s(new A);
+    A* p = s.get();
+    boost::unique_ptr<A> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,101 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<A> s(new A);
+    A* p = s.get();
+    boost::unique_ptr<A> s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+    {
+    boost::unique_ptr<A, Deleter> s(new A);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter> s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    {
+    CDeleter d;
+    boost::unique_ptr<A, CDeleter&> s(new A, d);
+    A* p = s.get();
+    boost::unique_ptr<A, CDeleter&> s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,36 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Can't copy from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    const boost::unique_ptr<A> s(new A);
+    A* p = s.get();
+    boost::unique_ptr<A> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,103 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) {delete p;}
+};
+
+boost::unique_ptr<A>
+source1()
+{
+    return boost::unique_ptr<A>(new A);
+}
+
+void sink1(boost::unique_ptr<A> p)
+{
+}
+
+boost::unique_ptr<A, Deleter>
+source2()
+{
+    return boost::unique_ptr<A, Deleter>(new A);
+}
+
+void sink2(boost::unique_ptr<A, Deleter> p)
+{
+}
+
+boost::unique_ptr<A, CDeleter&>
+source3()
+{
+    static CDeleter d;
+    return boost::unique_ptr<A, CDeleter&>(new A, d);
+}
+
+void sink3(boost::unique_ptr<A, CDeleter&> p)
+{
+}
+
+int main()
+{
+    sink1(source1());
+    sink2(source2());
+    sink3(source3());
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,49 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Can't copy from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<A, Deleter> s(new A);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,49 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test move ctor.  Can't copy from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    const boost::unique_ptr<A, Deleter> s(new A);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,49 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Can't construct from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A> s2(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,51 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A> s2(boost::move(s));
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,82 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter<A> > s2(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,86 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename boost::enable_if_c
+            <
+                boost::detail::is_convertible<U, T>::value
+            >::type* = 0)
+            : state_(d.state()) {}
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter<A> > s2(boost::move(s));
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,72 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    boost::unique_ptr<B, CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    boost::unique_ptr<A, CDeleter<A>&> s2(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,72 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    boost::unique_ptr<B, CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    boost::unique_ptr<A, CDeleter<A>&> s2(boost::move(s));
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,51 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,51 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A> s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,82 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter<A> > s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,82 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter<A> > s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,72 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    boost::unique_ptr<B, CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    boost::unique_ptr<A, CDeleter<A>&> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,72 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    boost::unique_ptr<B, CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    boost::unique_ptr<A, CDeleter<A>&> s2 = boost::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,51 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const boost::unique_ptr<B> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A> s2(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,82 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    const boost::unique_ptr<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter<A> > s2(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,72 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    const boost::unique_ptr<B, CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    boost::unique_ptr<A, CDeleter<A>&> s2(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,51 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const boost::unique_ptr<B> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,82 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(5) {}
+
+    template <class U>
+        Deleter(Deleter<U> d)
+            : state_(d->state()) {}
+
+    int state() const {return state_;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    const boost::unique_ptr<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A, Deleter<A> > s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,72 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    const boost::unique_ptr<B, CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    boost::unique_ptr<A, CDeleter<A>&> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,28 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr converting move ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// Do not convert from an array unique_ptr
+
+struct A
+{
+};
+
+struct Deleter
+{
+    void operator()(void*) {}
+};
+
+int main()
+{
+    boost::unique_ptr<A[], Deleter> s;
+    boost::unique_ptr<A, Deleter> s2(boost::move(s));
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,30 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr(pointer) ctor
+
+#include "unique_ptr.hpp"
+
+// unique_ptr(pointer) ctor should require default Deleter ctor
+class Deleter
+{
+
+    Deleter() {}
+
+public:
+
+    Deleter(Deleter&) {}
+    Deleter& operator=(Deleter&) {}
+
+    void operator()(void*) const {}
+};
+
+
+int main()
+{
+    boost::unique_ptr<int, Deleter> p(new int);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,57 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr(pointer) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr(pointer) ctor should only require default Deleter ctor
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    A* p = new A;
+    assert(A::count == 1);
+    boost::unique_ptr<A> s(p);
+    assert(s.get() == p);
+    }
+    assert(A::count == 0);
+    {
+    A* p = new A;
+    assert(A::count == 1);
+    boost::unique_ptr<A, Deleter> s(p);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,24 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr(pointer) ctor
+
+#include "unique_ptr.hpp"
+
+// unique_ptr(pointer) ctor should require non-reference Deleter ctor
+class Deleter
+{
+public:
+
+    void operator()(void*) {}
+};
+
+
+int main()
+{
+    boost::unique_ptr<int, Deleter&> p(new int);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,89 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr(pointer) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr(pointer) ctor shouldn't require complete type
+
+struct A;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p);
+};
+
+void check(int i);
+
+template <class D = boost::default_delete<A> >
+struct B
+{
+    boost::unique_ptr<A, D> a_;
+    explicit B(A*);
+    ~B();
+
+    A* get() const {return a_.get();}
+    D& get_deleter() {return a_.get_deleter();}
+};
+
+A* get();
+
+int main()
+{
+    {
+    A* p = get();
+    check(1);
+    B<> s(p);
+    assert(s.get() == p);
+    }
+    check(0);
+    {
+    A* p = get();
+    check(1);
+    B<Deleter> s(p);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    check(0);
+}
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+A* get() {return new A;}
+
+void Deleter::operator()(A* p) {delete p;}
+
+void check(int i)
+{
+    assert(A::count == i);
+}
+
+template <class D>
+B<D>::B(A* a) : a_(a) {}
+
+template <class D>
+B<D>::~B() {}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,17 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr(pointer) ctor
+
+#include "unique_ptr.hpp"
+
+// unique_ptr(pointer) ctor should require non-pointer Deleter
+
+int main()
+{
+    boost::unique_ptr<int, void (*)(void*)> p(new int);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,72 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr(pointer) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr(pointer) ctor should work with derived pointers
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    B* p = new B;
+    assert(A::count == 1);
+    assert(B::count == 1);
+    boost::unique_ptr<A> s(p);
+    assert(s.get() == p);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+    {
+    B* p = new B;
+    assert(A::count == 1);
+    assert(B::count == 1);
+    boost::unique_ptr<A, Deleter> s(p);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter01.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter01.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,53 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr(pointer) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr(pointer, deleter()) only requires MoveConstructible deleter
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    A* p = new A;
+    assert(A::count == 1);
+    boost::unique_ptr<A, Deleter> s(p, Deleter());
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter02.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter02.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,52 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr(pointer) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr(pointer, d) requires CopyConstructible deleter
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    A* p = new A;
+    assert(A::count == 1);
+    Deleter d;
+    boost::unique_ptr<A, Deleter> s(p, d);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    d.set_state(6);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter03.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter03.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,54 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr(pointer) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr<T, D&>(pointer, d) does not requires CopyConstructible deleter
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(const Deleter&);
+    Deleter& operator=(const Deleter&);
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    A* p = new A;
+    assert(A::count == 1);
+    Deleter d;
+    boost::unique_ptr<A, Deleter&> s(p, d);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    d.set_state(6);
+    assert(s.get_deleter().state() == 6);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,49 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr(pointer) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr<T, const D&>(pointer, D()) should not compile
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) const {delete p;}
+};
+
+int main()
+{
+    {
+    A* p = new A;
+    assert(A::count == 1);
+    boost::unique_ptr<A, const Deleter&> s(p, Deleter());
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,52 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr(pointer) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr<T, const D&>(pointer, d) does not requires CopyConstructible deleter
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(const Deleter&);
+    Deleter& operator=(const Deleter&);
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) const {delete p;}
+};
+
+int main()
+{
+    {
+    A* p = new A;
+    assert(A::count == 1);
+    Deleter d;
+    boost::unique_ptr<A, const Deleter&> s(p, d);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter05.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter05.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,60 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.ctor]
+// Test unique_ptr(pointer, deleter) ctor
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+// unique_ptr(pointer, deleter) should work with derived pointers
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    B* p = new B;
+    assert(A::count == 1);
+    assert(B::count == 1);
+    boost::unique_ptr<A, Deleter> s(p, Deleter());
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+CC=g++
+BOOST_INCLUDE="-I/Users/hinnant/Development/boost-dev/boost-trunk"
+SOURCE_INCLUDE="-I/Users/hinnant/Development/unique_ptr"
+OPTIONS=""
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/null.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/null.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,39 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.dtor]
+// The deleter is not called if get() == 0
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(0) {}
+
+    int state() const {return state_;}
+
+    void operator()(void*) {++state_;}
+};
+
+
+int main()
+{
+    Deleter d;
+    assert(d.state() == 0);
+    {
+    boost::unique_ptr<int, Deleter&> p(0, d);
+    assert(p.get() == 0);
+    assert(&p.get_deleter() == &d);
+    }
+    assert(d.state() == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+CC=g++
+BOOST_INCLUDE="-I/Users/hinnant/Development/boost-dev/boost-trunk"
+SOURCE_INCLUDE="-I/Users/hinnant/Development/unique_ptr"
+OPTIONS=""
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/release.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/release.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,20 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.modifiers]
+// test release
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+int main()
+{
+    boost::unique_ptr<int> p(new int(3));
+    int* i = p.get();
+    int* j = p.release();
+    assert(p.get() == 0);
+    assert(i == j);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset1.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset1.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,42 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.modifiers]
+// test reset
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<A> p(new A);
+    assert(A::count == 1);
+    A* i = p.get();
+    p.reset();
+    assert(A::count == 0);
+    assert(p.get() == 0);
+    }
+    assert(A::count == 0);
+    {
+    boost::unique_ptr<A> p(new A);
+    assert(A::count == 1);
+    A* i = p.get();
+    p.reset(new A);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset2.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset2.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,58 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.modifiers]
+// test reset
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<A> p(new A);
+    assert(A::count == 1);
+    assert(B::count == 0);
+    A* i = p.get();
+    p.reset(new B);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+    {
+    boost::unique_ptr<A> p(new B);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    A* i = p.get();
+    p.reset(new B);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/swap.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/swap.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,85 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.modifiers]
+// test swap
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    int state_;
+    static int count;
+    explicit A(int i) : state_(i) {++count;}
+    A(const A& a) : state_(a.state_) {++count;}
+    A& operator=(const A& a) {state_ = a.state_; return *this;}
+    ~A() {--count;}
+
+    friend bool operator==(const A& x, const A& y)
+        {return x.state_ == y.state_;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    operator boost::detail::rv<Deleter>() {return boost::detail::rv<Deleter>(*this);}
+    Deleter(boost::detail::rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(boost::detail::rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+
+    Deleter() : state_(0) {}
+    explicit Deleter(int i) : state_(i) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+
+    friend bool operator==(const Deleter& x, const Deleter& y)
+        {return x.state_ == y.state_;}
+};
+
+void
+swap(Deleter& x, Deleter& y)
+{
+    Deleter t(boost::move(x));
+    x = boost::move(y);
+    y = boost::move(t);
+}
+
+int main()
+{
+    {
+    A* p1 = new A(1);
+    boost::unique_ptr<A, Deleter> s1(p1, Deleter(1));
+    A* p2 = new A(2);
+    boost::unique_ptr<A, Deleter> s2(p2, Deleter(2));
+    assert(s1.get() == p1);
+    assert(*s1 == A(1));
+    assert(s1.get_deleter().state() == 1);
+    assert(s2.get() == p2);
+    assert(*s2 == A(2));
+    assert(s2.get_deleter().state() == 2);
+    swap(s1, s2);
+    assert(s1.get() == p2);
+    assert(*s1 == A(2));
+    assert(s1.get_deleter().state() == 2);
+    assert(s2.get() == p1);
+    assert(*s2 == A(1));
+    assert(s2.get_deleter().state() == 1);
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+CC=g++
+BOOST_INCLUDE="-I/Users/hinnant/Development/boost-dev/boost-trunk"
+SOURCE_INCLUDE="-I/Users/hinnant/Development/unique_ptr"
+OPTIONS=""
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/Jamfile.v2	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,10 @@
+# Jamfile.jam
+#
+# Copyright (c) 2009
+# Steven Watanabe
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+create-targets ;
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,17 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.observers]
+// test op*()
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+int main()
+{
+    boost::unique_ptr<int> p(new int(3));
+    assert(*p == 3);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,33 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.observers]
+// test op*()
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+int main()
+{
+    {
+    boost::unique_ptr<int> p(new int(3));
+    if (p)
+        ;
+    else
+        assert(false);
+    if (!p)
+        assert(false);
+    }
+    {
+    boost::unique_ptr<int> p;
+    if (!p)
+        ;
+    else
+        assert(false);
+    if (p)
+        assert(false);
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,18 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.observers]
+// test get
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+int main()
+{
+    int* p = new int;
+    boost::unique_ptr<int> s(p);
+    assert(s.get() == p);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,31 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.observers]
+// test get_deleter()
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct Deleter
+{
+    void operator()(void*) {}
+
+    int test() {return 5;}
+    int test() const {return 6;}
+};
+
+int main()
+{
+    {
+    boost::unique_ptr<int, Deleter> p;
+    assert(p.get_deleter().test() == 5);
+    }
+    {
+    const boost::unique_ptr<int, Deleter> p;
+    assert(p.get_deleter().test() == 6);
+    }
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,41 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.runtime.observers]
+// test op[](size_t)
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+class A
+{
+    int state_;
+    static int next_;
+public:
+    A() : state_(++next_) {}
+    int get() const {return state_;}
+
+    friend bool operator==(const A& x, int y)
+        {return x.state_ == y;}
+
+    A& operator=(int i) {state_ = i; return *this;}
+};
+
+int A::next_ = 0;
+
+int main()
+{
+    boost::unique_ptr<A> p(new A[3]);
+    assert(p[0] == 1);
+    assert(p[1] == 2);
+    assert(p[2] == 3);
+    p[0] = 3;
+    p[1] = 2;
+    p[2] = 1;
+    assert(p[0] == 3);
+    assert(p[1] == 2);
+    assert(p[2] == 1);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,24 @@
+// Copyright 2009 Howard Hinnant.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// [unique.ptr.single.observers]
+// test op->()
+
+#include "unique_ptr.hpp"
+#include <cassert>
+
+struct A
+{
+    int i_;
+
+    A() : i_(7) {}
+};
+
+int main()
+{
+    boost::unique_ptr<A> p(new A);
+    assert(p->i_ == 7);
+}
Added: sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/test
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique.ptr/unique.ptr.single/unique.ptr.single.observers/test	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 2009 Howard Hinnant.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+# See http://www.boost.org/libs/foreach for documentation
+
+CC=g++
+BOOST_INCLUDE="-I/Users/hinnant/Development/boost-dev/boost-trunk"
+SOURCE_INCLUDE="-I/Users/hinnant/Development/unique_ptr"
+OPTIONS=""
+FAIL=0
+
+echo "Testing in `pwd`"
+
+if (ls *.fail.cpp &> /dev/null)
+then
+    for FILE in $(ls *.fail.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE &> /dev/null
+        then
+            echo "$FILE should not compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+if (ls *.pass.cpp &> /dev/null)
+then
+    for FILE in $(ls *.pass.cpp); do
+        if $CC $BOOST_INCLUDE $SOURCE_INCLUDE $OPTIONS $FILE
+        then
+            if ./a.out
+            then
+                rm ./a.out
+            else
+                echo "$FILE failed at run time"
+                let "FAIL+=1"
+                rm ./a.out
+            fi
+        else
+            echo "$FILE failed to compile"
+            let "FAIL+=1"
+        fi
+    done
+fi
+
+for FILE in *
+do
+    if [ -d "$FILE" ];
+    then
+        cd $FILE
+        ./test
+        let "FAIL+=$?"
+        cd ..
+    fi
+done
+
+if [ "$FAIL" -gt 0 ]
+then
+	echo "failed $FAIL tests in `pwd`"
+else
+	echo "pass in `pwd`"
+fi
+
+exit $FAIL
Added: sandbox/unique_ptr/unique_ptr.hpp
==============================================================================
--- (empty file)
+++ sandbox/unique_ptr/unique_ptr.hpp	2009-01-08 15:36:16 EST (Thu, 08 Jan 2009)
@@ -0,0 +1,535 @@
+///////////////////////////////////////////////////////////////////////////////
+// unique_ptr.hpp header file
+//
+// Copyright 2009 Howard Hinnant, Ion Gaztañaga.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/foreach for documentation
+
+// This is a C++03 emulation of std::unique_ptr placed in namespace boost.
+// Reference http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2800.pdf
+//   for the latest unique_ptr specification, and
+//   reference http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html
+//   for any pending issues against this specification.
+
+#ifndef UNIQUE_PTR_HPP
+#define UNIQUE_PTR_HPP
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/mpl/if.hpp>
+
+namespace boost
+{
+
+namespace detail
+{
+
+typedef char one;
+struct two {one _[2];};
+
+// An is_convertible<From, To> that considers From an rvalue (consistent with C++0X).
+//   This is a simplified version neglecting the types function, array, void and abstract types
+//   I had to make a special case out of is_convertible<T,T> to make move-only
+//   types happy.
+
+namespace is_conv_imp
+{
+template <class T> one test1(const T&);
+template <class T> two test1(...);
+template <class T> one test2(T);
+template <class T> two test2(...);
+template <class T> T source();
+}
+
+template <class T1, class T2>
+struct is_convertible
+{
+    static const bool value = sizeof(is_conv_imp::test1<T2>(is_conv_imp::source<T1>())) == 1;
+};
+
+template <class T>
+struct is_convertible<T, T>
+{
+    static const bool value = sizeof(is_conv_imp::test2<T>(is_conv_imp::source<T>())) == 1;
+};
+
+template <class T>
+class rv
+{
+    T& r_;
+
+public:
+    explicit rv(T& r) : r_(r) {}
+    T* operator->() {return &r_;}
+    T& operator*() {return r_;}
+};
+
+template <class T>
+struct identity
+{
+    typedef T type;
+};
+
+}  // detail
+
+template <class T>
+inline
+typename enable_if_c
+<
+    !detail::is_convertible<T, detail::rv<T> >::value,
+    T&
+>::type
+move(T& t)
+{
+    return t;
+}
+
+template <class T>
+inline
+typename enable_if_c
+<
+    !detail::is_convertible<T, detail::rv<T> >::value,
+    const T&
+>::type
+move(const T& t)
+{
+    return t;
+}
+
+template <class T>
+inline
+typename enable_if_c
+<
+    detail::is_convertible<T, detail::rv<T> >::value,
+    T
+>::type
+move(T& t)
+{
+    return T(detail::rv<T>(t));
+}
+
+template <class T>
+inline
+typename enable_if_c
+<
+    is_reference<T>::value,
+    T
+>::type
+forward(typename detail::identity<T>::type t)
+{
+    return t;
+}
+
+template <class T>
+inline
+typename enable_if_c
+<
+    !is_reference<T>::value,
+    T
+>::type
+forward(typename detail::identity<T>::type& t)
+{
+    return move(t);
+}
+
+template <class T>
+inline
+typename enable_if_c
+<
+    !is_reference<T>::value,
+    T
+>::type
+forward(const typename detail::identity<T>::type& t)
+{
+    return move(const_cast<T&>(t));
+}
+
+namespace detail {
+
+// A move-aware but stripped-down compressed_pair which only optimizes storage for T2
+template <class T1, class T2, bool = is_empty<T2>::value>
+class unique_ptr_storage
+{
+    T1 t1_;
+    T2 t2_;
+
+    typedef typename add_reference<T2>::type T2_reference;
+    typedef typename add_reference<const T2>::type T2_const_reference;
+
+    unique_ptr_storage(const unique_ptr_storage&);
+    unique_ptr_storage& operator=(const unique_ptr_storage&);
+public:
+    operator rv<unique_ptr_storage>() {return rv<unique_ptr_storage>(*this);}
+
+    unique_ptr_storage() : t1_(), t2_() {}
+
+    explicit unique_ptr_storage(T1 t1)
+        : t1_(move(t1)), t2_() {}
+
+    unique_ptr_storage(T1 t1, T2 t2)
+        : t1_(move(t1)), t2_(forward<T2>(t2)) {}
+
+          T1& first()       {return t1_;}
+    const T1& first() const {return t1_;}
+
+          T2_reference second()       {return t2_;}
+    T2_const_reference second() const {return t2_;}
+};
+
+template <class T1, class T2>
+class unique_ptr_storage<T1, T2, true>
+    : private T2
+{
+    T1 t1_;
+    typedef T2 t2_;
+
+    unique_ptr_storage(const unique_ptr_storage&);
+    unique_ptr_storage& operator=(const unique_ptr_storage&);
+public:
+    operator rv<unique_ptr_storage>() {return rv<unique_ptr_storage>(*this);}
+
+    unique_ptr_storage() : t1_() {}
+
+    explicit unique_ptr_storage(T1 t1)
+        : t1_(move(t1)) {}
+
+    unique_ptr_storage(T1 t1, T2 t2)
+        : t2_(move(t2)), t1_(move(t1)) {}
+
+          T1& first()       {return t1_;}
+    const T1& first() const {return t1_;}
+
+          T2& second()       {return *this;}
+    const T2& second() const {return *this;}
+};
+
+template <class T1, class T2, bool b>
+inline
+void
+swap(unique_ptr_storage<T1, T2, b>& x, unique_ptr_storage<T1, T2, b>& y)
+{
+    using std::swap;
+    swap(x.first(), y.first());
+    swap(x.second(), y.second());
+}
+
+}  // detail
+
+template <class T>
+struct default_delete
+{
+    default_delete() {}
+    template <class U>
+        default_delete(const default_delete<U>&,
+            typename enable_if_c<detail::is_convertible<U*, T*>::value>::type* = 0)
+        {}
+
+    void operator()(T* ptr) const
+    {
+        BOOST_STATIC_ASSERT(sizeof(T) > 0);
+        delete ptr;
+    }
+};
+
+template <class T>
+struct default_delete<T[]>
+{
+    void operator()(T* ptr) const
+    {
+        BOOST_STATIC_ASSERT(sizeof(T) > 0);
+        delete [] ptr;
+    }
+
+private:
+
+    template <class U> void operator()(U*) const;
+};
+
+namespace detail
+{
+
+namespace pointer_type_imp
+{
+
+template <class U> static two test(...);
+template <class U> static one test(typename U::pointer* = 0);
+
+}  // pointer_type_imp
+
+template <class T>
+struct has_pointer_type
+{
+    static const bool value = sizeof(pointer_type_imp::test<T>(0)) == 1;
+};
+
+namespace pointer_type_imp
+{
+
+template <class T, class D, bool = has_pointer_type<D>::value>
+struct pointer_type
+{
+    typedef typename D::pointer type;
+};
+
+template <class T, class D>
+struct pointer_type<T, D, false>
+{
+    typedef T* type;
+};
+
+}  // pointer_type_imp
+
+template <class T, class D>
+struct pointer_type
+{
+    typedef typename pointer_type_imp::pointer_type<T,
+        typename boost::remove_reference<D>::type>::type type;
+};
+
+}  // detail
+
+template <class T, class D = default_delete<T> >
+class unique_ptr
+{
+public:
+    typedef T element_type;
+    typedef D deleter_type;
+    typedef typename detail::pointer_type<element_type, deleter_type>::type pointer;
+
+private:
+    detail::unique_ptr_storage<pointer, deleter_type> ptr_;
+
+    typedef typename add_reference<deleter_type>::type deleter_reference;
+    typedef typename add_reference<const deleter_type>::type deleter_const_reference;
+
+    struct nat {int for_bool_;};
+
+    unique_ptr(unique_ptr&);
+    unique_ptr& operator=(unique_ptr&);
+
+public:
+    operator detail::rv<unique_ptr>() {return detail::rv<unique_ptr>(*this);}
+    unique_ptr(detail::rv<unique_ptr> r) : ptr_(r->release(), forward<deleter_type>(r->get_deleter())) {}
+    unique_ptr& operator=(detail::rv<unique_ptr> r)
+    {
+        reset(r->release());
+        ptr_.second() = move(r->get_deleter());
+        return *this;
+    }
+
+    unique_ptr()
+        {
+            BOOST_STATIC_ASSERT(!is_reference<deleter_type>::value);
+            BOOST_STATIC_ASSERT(!is_pointer<deleter_type>::value);
+        }
+
+    explicit unique_ptr(pointer p)
+        : ptr_(p)
+        {
+            BOOST_STATIC_ASSERT(!is_reference<deleter_type>::value);
+            BOOST_STATIC_ASSERT(!is_pointer<deleter_type>::value);
+        }
+
+    unique_ptr(pointer p, typename mpl::if_<is_reference<D>,
+                          volatile typename remove_reference<D>::type&, D>::type d)
+        : ptr_(move(p), forward<D>(const_cast<typename add_reference<D>::type>(d))) {}
+
+    template <class U, class E>
+        unique_ptr(unique_ptr<U, E> u,
+            typename enable_if_c
+                <
+                !boost::is_array<U>::value &&
+                detail::is_convertible<typename unique_ptr<U>::pointer, pointer>::value &&
+                detail::is_convertible<E, deleter_type>::value &&
+                (
+                    !is_reference<deleter_type>::value ||
+                     is_same<deleter_type, E>::value
+                )
+                >::type* = 0)
+            : ptr_(u.release(), forward<D>(forward<E>(u.get_deleter()))) {}
+
+    ~unique_ptr() {reset();}
+
+    unique_ptr& operator=(int nat::*)
+    {
+        reset();
+        return *this;
+    }
+
+    template <class U, class E>
+        unique_ptr&
+        operator=(unique_ptr<U, E> u)
+        {
+            reset(u.release());
+            ptr_.second() = move(u.get_deleter());
+            return *this;
+        }
+
+    typename add_reference<T>::type operator*() const {return *get();}
+    pointer operator->() const {return get();}
+    pointer get() const {return ptr_.first();}
+    deleter_reference       get_deleter()       {return ptr_.second();}
+    deleter_const_reference get_deleter() const {return ptr_.second();}
+    operator int nat::*() const {return get() ? &nat::for_bool_ : 0;}
+
+    void reset(pointer p = pointer())
+    {
+        pointer t = get();
+        if (t != pointer())
+            get_deleter()(t);
+        ptr_.first() = p;
+    }
+
+    pointer release()
+    {
+        pointer tmp = get();
+        ptr_.first() = pointer();
+        return tmp;
+    }
+
+    void swap(unique_ptr& u) {detail::swap(ptr_, u.ptr_);}
+};
+
+template <class T, class D>
+class unique_ptr<T[], D>
+{
+public:
+    typedef T element_type;
+    typedef D deleter_type;
+    typedef typename detail::pointer_type<element_type, deleter_type>::type pointer;
+
+private:
+    detail::unique_ptr_storage<pointer, deleter_type> ptr_;
+
+    typedef typename add_reference<deleter_type>::type deleter_reference;
+    typedef typename add_reference<const deleter_type>::type deleter_const_reference;
+
+    struct nat {int for_bool_;};
+
+    unique_ptr(unique_ptr&);
+    unique_ptr& operator=(unique_ptr&);
+
+public:
+    operator detail::rv<unique_ptr>() {return detail::rv<unique_ptr>(*this);}
+    unique_ptr(detail::rv<unique_ptr> r) : ptr_(r->release(), forward<deleter_type>(r->get_deleter())) {}
+    unique_ptr& operator=(detail::rv<unique_ptr> r)
+    {
+        reset(r->release());
+        ptr_.second() = move(r->get_deleter());
+        return *this;
+    }
+
+    unique_ptr()
+        {
+            BOOST_STATIC_ASSERT(!is_reference<deleter_type>::value);
+            BOOST_STATIC_ASSERT(!is_pointer<deleter_type>::value);
+        }
+
+    explicit unique_ptr(pointer p)
+        : ptr_(p)
+        {
+            BOOST_STATIC_ASSERT(!is_reference<deleter_type>::value);
+            BOOST_STATIC_ASSERT(!is_pointer<deleter_type>::value);
+        }
+
+    unique_ptr(pointer p, typename mpl::if_<is_reference<D>,
+                          volatile typename remove_reference<D>::type&, D>::type d)
+        : ptr_(move(p), forward<D>(const_cast<typename add_reference<D>::type>(d))) {}
+
+    ~unique_ptr() {reset();}
+
+    T& operator[](size_t i) const {return get()[i];}
+    pointer get() const {return ptr_.first();}
+    deleter_reference       get_deleter()       {return ptr_.second();}
+    deleter_const_reference get_deleter() const {return ptr_.second();}
+    operator int nat::*() const {return get() ? &nat::for_bool_ : 0;}
+
+    void reset(pointer p = pointer())
+    {
+        pointer t = get();
+        if (t != pointer())
+            get_deleter()(t);
+        ptr_.first() = p;
+    }
+
+    pointer release()
+    {
+        pointer tmp = get();
+        ptr_.first() = pointer();
+        return tmp;
+    }
+
+    void swap(unique_ptr& u) {detail::swap(ptr_, u.ptr_);}
+private:
+    template <class U>
+        explicit unique_ptr(U,
+            typename enable_if_c<detail::is_convertible<U, pointer>::value>::type* = 0);
+
+    template <class U>
+        unique_ptr(U, typename mpl::if_<is_reference<D>,
+                          volatile typename remove_reference<D>::type&, D>::type,
+                          typename enable_if_c<detail::is_convertible<U, pointer>::value>::type* = 0);
+};
+
+template<class T, class D>
+inline
+void
+swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y)
+{
+    x.swap(y);
+}
+
+template<class T1, class D1, class T2, class D2>
+inline
+bool
+operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y)
+{
+    return x.get() == y.get();
+}
+
+template<class T1, class D1, class T2, class D2>
+inline
+bool
+operator!=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y)
+{
+    return !(x == y);
+}
+
+template<class T1, class D1, class T2, class D2> 
+inline
+bool
+operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y)
+{
+    return x.get() < y.get();
+}
+
+template<class T1, class D1, class T2, class D2> 
+inline
+bool
+operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y)
+{
+    return !(y < x);
+}
+
+template<class T1, class D1, class T2, class D2> 
+inline
+bool
+operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y)
+{
+    return y < x;
+}
+
+template<class T1, class D1, class T2, class D2> 
+inline
+bool
+operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y)
+{
+    return !(x < y);
+}
+
+}  // boost
+
+#endif  // UNIQUE_PTR_HPP