[cfe-commits] [libcxx] r103516 [4/6] - in /libcxx/trunk: include/ include/ext/ src/ test/ test/algorithms/ test/algorithms/alg.c.library/ test/algorithms/alg.modifying.operations/ test/algorithms/alg.modifying.operations/alg.copy/ test/algorithms/alg.modifying.operations/alg.fill/ test/algorithms/alg.modifying.operations/alg.generate/ test/algorithms/alg.modifying.operations/alg.move/ test/algorithms/alg.modifying.operations/alg.partitions/ test/algorithms/alg.modifying.operations/alg.random.shuffle/ test/algorithms/a...
Howard Hinnant
hhinnant at apple.com
Tue May 11 14:36:13 PDT 2010
Modified: libcxx/trunk/test/thread/thread.req/thread.req.native/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.req/thread.req.native/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.req/thread.req.native/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.req/thread.req.native/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.req/thread.req.paramname/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.req/thread.req.paramname/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.req/thread.req.paramname/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.req/thread.req.paramname/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.req/thread.req.timing/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.req/thread.req.timing/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.req/thread.req.timing/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.req/thread.req.timing/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.class/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.class/types.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.class/types.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.class/types.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/thread.thread.this/yield.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/thread.thread.this/yield.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/thread.thread.this/yield.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/thread.thread.this/yield.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/thread/thread.threads/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/thread/thread.threads/version.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/thread/thread.threads/version.pass.cpp (original)
+++ libcxx/trunk/test/thread/thread.threads/version.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/date.time/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/date.time/tested_elsewhere.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/date.time/tested_elsewhere.pass.cpp (original)
+++ libcxx/trunk/test/utilities/date.time/tested_elsewhere.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <ctime>
#include <type_traits>
#ifndef NULL
#error NULL not defined
#endif
#ifndef CLOCKS_PER_SEC
#error CLOCKS_PER_SEC not defined
#endif
int main()
{
std::clock_t c = 0;
std::size_t s = 0;
std::time_t t = 0;
std::tm tm = {0};
char str[3];
static_assert((std::is_same<decltype(std::clock()), std::clock_t>::value), "");
static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
static_asse
rt((std::is_same<decltype(std::asctime(&tm)), char*>::value), "");
static_assert((std::is_same<decltype(std::ctime(&t)), char*>::value), "");
static_assert((std::is_same<decltype(std::gmtime(&t)), std::tm*>::value), "");
static_assert((std::is_same<decltype(std::localtime(&t)), std::tm*>::value), "");
static_assert((std::is_same<decltype(std::strftime(str,s,"",&tm)), std::size_t>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <ctime>
#include <type_traits>
#ifndef NULL
#error NULL not defined
#endif
#ifndef CLOCKS_PER_SEC
#error CLOCKS_PER_SEC not defined
#endif
int main()
{
std::clock_t c = 0;
std::size_t s = 0;
std::time_t t = 0;
std::tm tm = {0};
char str[3];
static_assert((std::is_same<decltype(std::clock()), std::clock_t>::value), "");
static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
static_assert((std::is_same<dec
ltype(std::asctime(&tm)), char*>::value), "");
static_assert((std::is_same<decltype(std::ctime(&t)), char*>::value), "");
static_assert((std::is_same<decltype(std::gmtime(&t)), std::tm*>::value), "");
static_assert((std::is_same<decltype(std::localtime(&t)), std::tm*>::value), "");
static_assert((std::is_same<decltype(std::strftime(str,s,"",&tm)), std::size_t>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// divides
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::divides<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(36, 4) == 9);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// divides
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::divides<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(36, 4) == 9);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// minus
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::minus<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(3, 2) == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// minus
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::minus<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(3, 2) == 1);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// modulus
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::modulus<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(36, 8) == 4);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// modulus
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::modulus<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(36, 8) == 4);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// multiplies
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::multiplies<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(3, 2) == 6);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// multiplies
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::multiplies<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(3, 2) == 6);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// negate
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::negate<int> F;
const F f = F();
static_assert((std::is_base_of<std::unary_function<int, int>, F>::value), "");
assert(f(36) == -36);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// negate
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::negate<int> F;
const F f = F();
static_assert((std::is_base_of<std::unary_function<int, int>, F>::value), "");
assert(f(36) == -36);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// plus
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::plus<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(3, 2) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// plus
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::plus<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(3, 2) == 5);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/base/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/base/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/base/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/base/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
#include <functional>
#include <cassert>
template <class R, class F>
void
test(F f, R expected)
{
assert(f() == expected);
}
template <class R, class F>
void
test_const(const F& f, R expected)
{
assert(f() == expected);
}
int f() {return 1;}
struct A_int_0
{
int operator()() {return 4;}
int operator()() const {return 5;}
};
int main()
{
test(std::bind(f), 1);
te
st(std::bind(&f), 1);
test(std::bind(A_int_0()), 4);
test_const(std::bind(A_int_0()), 5);
test(std::bind<int>(f), 1);
test(std::bind<int>(&f), 1);
test(std::bind<int>(A_int_0()), 4);
test_const(std::bind<int>(A_int_0()), 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
#include <functional>
#include <cassert>
template <class R, class F>
void
test(F f, R expected)
{
assert(f() == expected);
}
template <class R, class F>
void
test_const(const F& f, R expected)
{
assert(f() == expected);
}
int f() {return 1;}
struct A_int_0
{
int operator()() {return 4;}
int operator()() const {return 5;}
};
int main()
{
test(std::bind(f), 1);
test(std::bind(&f), 1)
;
test(std::bind(A_int_0()), 4);
test_const(std::bind(A_int_0()), 5);
test(std::bind<int>(f), 1);
test(std::bind<int>(&f), 1);
test(std::bind<int>(A_int_0()), 4);
test_const(std::bind<int>(A_int_0()), 5);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
#include <stdio.h>
#include <functional>
#include <cassert>
int count = 0;
// 1 arg, return void
void f_void_1(int i)
{
count += i;
}
struct A_void_1
{
void operator()(int i)
{
count += i;
}
void mem1() {++count;}
void mem2() const {count += 2;}
};
void
test_void_1()
{
using namespace std::placeholders;
int save_count = count;
// function
{
int i = 2;
std::bind(f_void_1, _1)(i);
assert(count == save_count + 2);
save_count = count;
}
{
int i = 2;
std::bind(f_void_1, i)();
assert(count == save_count + 2);
save_count = count;
}
// function pointer
{
void (*fp)(int) = f_void_1;
int i = 3;
std::bind(fp, _1)(i);
assert(count == save_count+3);
save_count = count;
}
{
void (*fp)(int) = f_void_1;
int i = 3;
std::bind(fp, i)();
assert(count == save_count+3);
save_count = count;
}
// functor
{
A_void_1 a0;
int i = 4;
std::bind(a0, _1)(i);
assert(count == save_count+4);
save_count = count;
}
{
A_void_1 a0;
int i = 4;
std::bind(a0, i)();
assert(count == save_count+4);
save_count = count;
}
// member function pointer
{
void (A_void_1::*fp)() = &A_void_1::mem1;
A_void_1 a;
std::bind(fp, _1)(a);
assert(count == save_count+1);
save_co
unt = count;
A_void_1* ap = &a;
std::bind(fp, _1)(ap);
assert(count == save_count+1);
save_count = count;
}
{
void (A_void_1::*fp)() = &A_void_1::mem1;
A_void_1 a;
std::bind(fp, a)();
assert(count == save_count+1);
save_count = count;
A_void_1* ap = &a;
std::bind(fp, ap)();
assert(count == save_count+1);
save_count = count;
}
// const member function pointer
{
void (A_void_1::*fp)() const = &A_void_1::mem2;
A_void_1 a;
std::bind(fp, _1)(a);
assert(count == save_count+2);
save_count = count;
A_void_1* ap = &a;
std::bind(fp, _1)(ap);
assert(count == save_count+2);
save_count = count;
}
{
void (A_void_1::*fp)() const = &A_void_1::mem2;
A_void_1 a;
std::bind(fp, a)();
assert(count == save_count+2);
save_count = count;
A_void_1* ap = &a;
std::bind(fp, ap)();
assert(count == save_count+2);
save_count = count;
}
}
// 1 arg, ret
urn int
int f_int_1(int i)
{
return i + 1;
}
struct A_int_1
{
A_int_1() : data_(5) {}
int operator()(int i)
{
return i - 1;
}
int mem1() {return 3;}
int mem2() const {return 4;}
int data_;
};
void
test_int_1()
{
using namespace std::placeholders;
// function
{
int i = 2;
assert(std::bind(f_int_1, _1)(i) == 3);
assert(std::bind(f_int_1, i)() == 3);
}
// function pointer
{
int (*fp)(int) = f_int_1;
int i = 3;
assert(std::bind(fp, _1)(i) == 4);
assert(std::bind(fp, i)() == 4);
}
// functor
{
int i = 4;
assert(std::bind(A_int_1(), _1)(i) == 3);
assert(std::bind(A_int_1(), i)() == 3);
}
// member function pointer
{
A_int_1 a;
assert(std::bind(&A_int_1::mem1, _1)(a) == 3);
assert(std::bind(&A_int_1::mem1, a)() == 3);
A_int_1* ap = &a;
assert(std::bind(&A_int_1::mem1, _1)(ap) == 3);
assert(std::bind(&A_int_1::mem1, ap)() == 3);
}
// const member function pointer
{
A_int_1 a;
assert(std::bind(&A_int_1::mem2, _1)(A_int_1()) == 4);
assert(std::bind(&A_int_1::mem2, A_int_1())() == 4);
A_int_1* ap = &a;
assert(std::bind(&A_int_1::mem2, _1)(ap) == 4);
assert(std::bind(&A_int_1::mem2, ap)() == 4);
}
// member data pointer
{
A_int_1 a;
assert(std::bind(&A_int_1::data_, _1)(a) == 5);
assert(std::bind(&A_int_1::data_, a)() == 5);
A_int_1* ap = &a;
assert(std::bind(&A_int_1::data_, _1)(a) == 5);
std::bind(&A_int_1::data_, _1)(a) = 6;
assert(std::bind(&A_int_1::data_, _1)(a) == 6);
assert(std::bind(&A_int_1::data_, _1)(ap) == 6);
std::bind(&A_int_1::data_, _1)(ap) = 7;
assert(std::bind(&A_int_1::data_, _1)(ap) == 7);
}
}
// 2 arg, return void
void f_void_2(int i, int j)
{
count += i+j;
}
struct A_void_2
{
void operator()(int i, int j)
{
count += i+j;
}
void mem1(int i) {count += i;}
v
oid mem2(int i) const {count += i;}
};
void
test_void_2()
{
using namespace std::placeholders;
int save_count = count;
// function
{
int i = 2;
int j = 3;
std::bind(f_void_2, _1, _2)(i, j);
assert(count == save_count+5);
save_count = count;
std::bind(f_void_2, i, _1)(j);
assert(count == save_count+5);
save_count = count;
std::bind(f_void_2, i, j)();
assert(count == save_count+5);
save_count = count;
}
// member function pointer
{
int j = 3;
std::bind(&A_void_2::mem1, _1, _2)(A_void_2(), j);
assert(count == save_count+3);
save_count = count;
std::bind(&A_void_2::mem1, _2, _1)(j, A_void_2());
assert(count == save_count+3);
save_count = count;
}
}
int main()
{
test_void_1();
test_int_1();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
#include <stdio.h>
#include <functional>
#include <cassert>
int count = 0;
// 1 arg, return void
void f_void_1(int i)
{
count += i;
}
struct A_void_1
{
void operator()(int i)
{
count += i;
}
void mem1() {++count;}
void mem2() const {count += 2;}
};
void
test_void_1()
{
using namespace std::placeholders;
int save_count = count;
// function
{
int i = 2;
std::bind(f_void_1, _1)(i);
assert(count == save_count + 2);
save_count = count;
}
{
int i = 2;
std::bind(f_void_1, i)();
assert(count == save_count + 2);
save_count = count;
}
// function pointer
{
void (*fp)(int) = f_void_1;
int i = 3;
std::bind(fp, _1)(i);
assert(count == save_count+3);
save_count = count;
}
{
void (*fp)(int) = f_void_1;
int i = 3;
std::bind(fp, i)();
assert(count == save_count+3);
save_count = count;
}
// functor
{
A_void_1 a0;
int i = 4;
std::bind(a0, _1)(i);
assert(count == save_count+4);
save_count = count;
}
{
A_void_1 a0;
int i = 4;
std::bind(a0, i)();
assert(count == save_count+4);
save_count = count;
}
// member function pointer
{
void (A_void_1::*fp)() = &A_void_1::mem1;
A_void_1 a;
std::bind(fp, _1)(a);
assert(count == save_count+1);
save_count = count;
A_v
oid_1* ap = &a;
std::bind(fp, _1)(ap);
assert(count == save_count+1);
save_count = count;
}
{
void (A_void_1::*fp)() = &A_void_1::mem1;
A_void_1 a;
std::bind(fp, a)();
assert(count == save_count+1);
save_count = count;
A_void_1* ap = &a;
std::bind(fp, ap)();
assert(count == save_count+1);
save_count = count;
}
// const member function pointer
{
void (A_void_1::*fp)() const = &A_void_1::mem2;
A_void_1 a;
std::bind(fp, _1)(a);
assert(count == save_count+2);
save_count = count;
A_void_1* ap = &a;
std::bind(fp, _1)(ap);
assert(count == save_count+2);
save_count = count;
}
{
void (A_void_1::*fp)() const = &A_void_1::mem2;
A_void_1 a;
std::bind(fp, a)();
assert(count == save_count+2);
save_count = count;
A_void_1* ap = &a;
std::bind(fp, ap)();
assert(count == save_count+2);
save_count = count;
}
}
// 1 arg, return int
int f_int_1
(int i)
{
return i + 1;
}
struct A_int_1
{
A_int_1() : data_(5) {}
int operator()(int i)
{
return i - 1;
}
int mem1() {return 3;}
int mem2() const {return 4;}
int data_;
};
void
test_int_1()
{
using namespace std::placeholders;
// function
{
int i = 2;
assert(std::bind(f_int_1, _1)(i) == 3);
assert(std::bind(f_int_1, i)() == 3);
}
// function pointer
{
int (*fp)(int) = f_int_1;
int i = 3;
assert(std::bind(fp, _1)(i) == 4);
assert(std::bind(fp, i)() == 4);
}
// functor
{
int i = 4;
assert(std::bind(A_int_1(), _1)(i) == 3);
assert(std::bind(A_int_1(), i)() == 3);
}
// member function pointer
{
A_int_1 a;
assert(std::bind(&A_int_1::mem1, _1)(a) == 3);
assert(std::bind(&A_int_1::mem1, a)() == 3);
A_int_1* ap = &a;
assert(std::bind(&A_int_1::mem1, _1)(ap) == 3);
assert(std::bind(&A_int_1::mem1, ap)() == 3);
}
// const m
ember function pointer
{
A_int_1 a;
assert(std::bind(&A_int_1::mem2, _1)(A_int_1()) == 4);
assert(std::bind(&A_int_1::mem2, A_int_1())() == 4);
A_int_1* ap = &a;
assert(std::bind(&A_int_1::mem2, _1)(ap) == 4);
assert(std::bind(&A_int_1::mem2, ap)() == 4);
}
// member data pointer
{
A_int_1 a;
assert(std::bind(&A_int_1::data_, _1)(a) == 5);
assert(std::bind(&A_int_1::data_, a)() == 5);
A_int_1* ap = &a;
assert(std::bind(&A_int_1::data_, _1)(a) == 5);
std::bind(&A_int_1::data_, _1)(a) = 6;
assert(std::bind(&A_int_1::data_, _1)(a) == 6);
assert(std::bind(&A_int_1::data_, _1)(ap) == 6);
std::bind(&A_int_1::data_, _1)(ap) = 7;
assert(std::bind(&A_int_1::data_, _1)(ap) == 7);
}
}
// 2 arg, return void
void f_void_2(int i, int j)
{
count += i+j;
}
struct A_void_2
{
void operator()(int i, int j)
{
count += i+j;
}
void mem1(int i) {count += i;}
void mem2(int i) cons
t {count += i;}
};
void
test_void_2()
{
using namespace std::placeholders;
int save_count = count;
// function
{
int i = 2;
int j = 3;
std::bind(f_void_2, _1, _2)(i, j);
assert(count == save_count+5);
save_count = count;
std::bind(f_void_2, i, _1)(j);
assert(count == save_count+5);
save_count = count;
std::bind(f_void_2, i, j)();
assert(count == save_count+5);
save_count = count;
}
// member function pointer
{
int j = 3;
std::bind(&A_void_2::mem1, _1, _2)(A_void_2(), j);
assert(count == save_count+3);
save_count = count;
std::bind(&A_void_2::mem1, _2, _1)(j, A_void_2());
assert(count == save_count+3);
save_count = count;
}
}
int main()
{
test_void_1();
test_int_1();
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
#include <stdio.h>
#include <functional>
#include <cassert>
int count = 0;
// 1 arg, return void
void f_void_1(int i)
{
count += i;
}
struct A_void_1
{
void operator()(int i)
{
count += i;
}
void mem1() {++count;}
void mem2() const {count += 2;}
};
void
test_void_1()
{
using namespace std::placeholders;
int save_count = count;
// function
{
std::bind(f_void_1, _1)(2);
assert(count == save_count + 2);
save_count = count;
}
{
std::bind(f_void_1, 2)();
assert(count == save_count + 2);
save_count = count;
}
// function pointer
{
void (*fp)(int) = f_void_1;
std::bind(fp, _1)(3);
assert(count == save_count+3);
save_count = count;
}
{
void (*fp)(int) = f_void_1;
std::bind(fp, 3)();
assert(count == save_count+3);
save_count = count;
}
// functor
{
A_void_1 a0;
std::bind(a0, _1)(4);
assert(count == save_count+4);
save_count = count;
}
{
A_void_1 a0;
std::bind(a0, 4)();
assert(count == save_count+4);
save_count = count;
}
// member function pointer
{
void (A_void_1::*fp)() = &A_void_1::mem1;
std::bind(fp, _1)(A_void_1());
assert(count == save_count+1);
save_count = count;
A_void_1 a;
std::bind(fp, _1)(&a);
assert(count == save_count+1);
sa
ve_count = count;
}
{
void (A_void_1::*fp)() = &A_void_1::mem1;
std::bind(fp, A_void_1())();
assert(count == save_count+1);
save_count = count;
A_void_1 a;
std::bind(fp, &a)();
assert(count == save_count+1);
save_count = count;
}
// const member function pointer
{
void (A_void_1::*fp)() const = &A_void_1::mem2;
std::bind(fp, _1)(A_void_1());
assert(count == save_count+2);
save_count = count;
A_void_1 a;
std::bind(fp, _1)(&a);
assert(count == save_count+2);
save_count = count;
}
{
void (A_void_1::*fp)() const = &A_void_1::mem2;
std::bind(fp, A_void_1())();
assert(count == save_count+2);
save_count = count;
A_void_1 a;
std::bind(fp, &a)();
assert(count == save_count+2);
save_count = count;
}
}
// 1 arg, return int
int f_int_1(int i)
{
return i + 1;
}
struct A_int_1
{
A_int_1() : data_(5) {}
int operator()(int i)
{
return i -
1;
}
int mem1() {return 3;}
int mem2() const {return 4;}
int data_;
};
void
test_int_1()
{
using namespace std::placeholders;
// function
{
assert(std::bind(f_int_1, _1)(2) == 3);
assert(std::bind(f_int_1, 2)() == 3);
}
// function pointer
{
int (*fp)(int) = f_int_1;
assert(std::bind(fp, _1)(3) == 4);
assert(std::bind(fp, 3)() == 4);
}
// functor
{
assert(std::bind(A_int_1(), _1)(4) == 3);
assert(std::bind(A_int_1(), 4)() == 3);
}
// member function pointer
{
assert(std::bind(&A_int_1::mem1, _1)(A_int_1()) == 3);
assert(std::bind(&A_int_1::mem1, A_int_1())() == 3);
A_int_1 a;
assert(std::bind(&A_int_1::mem1, _1)(&a) == 3);
assert(std::bind(&A_int_1::mem1, &a)() == 3);
}
// const member function pointer
{
assert(std::bind(&A_int_1::mem2, _1)(A_int_1()) == 4);
assert(std::bind(&A_int_1::mem2, A_int_1())() == 4);
A_int_1 a;
assert(std::b
ind(&A_int_1::mem2, _1)(&a) == 4);
assert(std::bind(&A_int_1::mem2, &a)() == 4);
}
// member data pointer
{
assert(std::bind(&A_int_1::data_, _1)(A_int_1()) == 5);
assert(std::bind(&A_int_1::data_, A_int_1())() == 5);
A_int_1 a;
assert(std::bind(&A_int_1::data_, _1)(a) == 5);
std::bind(&A_int_1::data_, _1)(a) = 6;
assert(std::bind(&A_int_1::data_, _1)(a) == 6);
assert(std::bind(&A_int_1::data_, _1)(&a) == 6);
std::bind(&A_int_1::data_, _1)(&a) = 7;
assert(std::bind(&A_int_1::data_, _1)(&a) == 7);
}
}
// 2 arg, return void
void f_void_2(int i, int j)
{
count += i+j;
}
struct A_void_2
{
void operator()(int i, int j)
{
count += i+j;
}
void mem1(int i) {count += i;}
void mem2(int i) const {count += i;}
};
void
test_void_2()
{
using namespace std::placeholders;
int save_count = count;
// function
{
std::bind(f_void_2, _1, _2)(2, 3);
assert(count == save_count+5);
save_count = count;
std::bind(f_void_2, 2, _1)(3);
assert(count == save_count+5);
save_count = count;
std::bind(f_void_2, 2, 3)();
assert(count == save_count+5);
save_count = count;
}
// member function pointer
{
std::bind(&A_void_2::mem1, _1, _2)(A_void_2(), 3);
assert(count == save_count+3);
save_count = count;
std::bind(&A_void_2::mem1, _2, _1)(3, A_void_2());
assert(count == save_count+3);
save_count = count;
}
}
int main()
{
test_void_1();
test_int_1();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
#include <stdio.h>
#include <functional>
#include <cassert>
int count = 0;
// 1 arg, return void
void f_void_1(int i)
{
count += i;
}
struct A_void_1
{
void operator()(int i)
{
count += i;
}
void mem1() {++count;}
void mem2() const {count += 2;}
};
void
test_void_1()
{
using namespace std::placeholders;
int save_count = count;
// function
{
std::bind(f
_void_1, _1)(2);
assert(count == save_count + 2);
save_count = count;
}
{
std::bind(f_void_1, 2)();
assert(count == save_count + 2);
save_count = count;
}
// function pointer
{
void (*fp)(int) = f_void_1;
std::bind(fp, _1)(3);
assert(count == save_count+3);
save_count = count;
}
{
void (*fp)(int) = f_void_1;
std::bind(fp, 3)();
assert(count == save_count+3);
save_count = count;
}
// functor
{
A_void_1 a0;
std::bind(a0, _1)(4);
assert(count == save_count+4);
save_count = count;
}
{
A_void_1 a0;
std::bind(a0, 4)();
assert(count == save_count+4);
save_count = count;
}
// member function pointer
{
void (A_void_1::*fp)() = &A_void_1::mem1;
std::bind(fp, _1)(A_void_1());
assert(count == save_count+1);
save_count = count;
A_void_1 a;
std::bind(fp, _1)(&a);
assert(count == save_count+1);
save_count = count;
}
{
void (A_void_1::*fp)() = &A_void_1::mem1;
std::bind(fp, A_void_1())();
assert(count == save_count+1);
save_count = count;
A_void_1 a;
std::bind(fp, &a)();
assert(count == save_count+1);
save_count = count;
}
// const member function pointer
{
void (A_void_1::*fp)() const = &A_void_1::mem2;
std::bind(fp, _1)(A_void_1());
assert(count == save_count+2);
save_count = count;
A_void_1 a;
std::bind(fp, _1)(&a);
assert(count == save_count+2);
save_count = count;
}
{
void (A_void_1::*fp)() const = &A_void_1::mem2;
std::bind(fp, A_void_1())();
assert(count == save_count+2);
save_count = count;
A_void_1 a;
std::bind(fp, &a)();
assert(count == save_count+2);
save_count = count;
}
}
// 1 arg, return int
int f_int_1(int i)
{
return i + 1;
}
struct A_int_1
{
A_int_1() : data_(5) {}
int operator()(int i)
{
return i - 1;
}
int m
em1() {return 3;}
int mem2() const {return 4;}
int data_;
};
void
test_int_1()
{
using namespace std::placeholders;
// function
{
assert(std::bind(f_int_1, _1)(2) == 3);
assert(std::bind(f_int_1, 2)() == 3);
}
// function pointer
{
int (*fp)(int) = f_int_1;
assert(std::bind(fp, _1)(3) == 4);
assert(std::bind(fp, 3)() == 4);
}
// functor
{
assert(std::bind(A_int_1(), _1)(4) == 3);
assert(std::bind(A_int_1(), 4)() == 3);
}
// member function pointer
{
assert(std::bind(&A_int_1::mem1, _1)(A_int_1()) == 3);
assert(std::bind(&A_int_1::mem1, A_int_1())() == 3);
A_int_1 a;
assert(std::bind(&A_int_1::mem1, _1)(&a) == 3);
assert(std::bind(&A_int_1::mem1, &a)() == 3);
}
// const member function pointer
{
assert(std::bind(&A_int_1::mem2, _1)(A_int_1()) == 4);
assert(std::bind(&A_int_1::mem2, A_int_1())() == 4);
A_int_1 a;
assert(std::bind(&A_int_1::mem2,
_1)(&a) == 4);
assert(std::bind(&A_int_1::mem2, &a)() == 4);
}
// member data pointer
{
assert(std::bind(&A_int_1::data_, _1)(A_int_1()) == 5);
assert(std::bind(&A_int_1::data_, A_int_1())() == 5);
A_int_1 a;
assert(std::bind(&A_int_1::data_, _1)(a) == 5);
std::bind(&A_int_1::data_, _1)(a) = 6;
assert(std::bind(&A_int_1::data_, _1)(a) == 6);
assert(std::bind(&A_int_1::data_, _1)(&a) == 6);
std::bind(&A_int_1::data_, _1)(&a) = 7;
assert(std::bind(&A_int_1::data_, _1)(&a) == 7);
}
}
// 2 arg, return void
void f_void_2(int i, int j)
{
count += i+j;
}
struct A_void_2
{
void operator()(int i, int j)
{
count += i+j;
}
void mem1(int i) {count += i;}
void mem2(int i) const {count += i;}
};
void
test_void_2()
{
using namespace std::placeholders;
int save_count = count;
// function
{
std::bind(f_void_2, _1, _2)(2, 3);
assert(count == save_count+5);
save_count = coun
t;
std::bind(f_void_2, 2, _1)(3);
assert(count == save_count+5);
save_count = count;
std::bind(f_void_2, 2, 3)();
assert(count == save_count+5);
save_count = count;
}
// member function pointer
{
std::bind(&A_void_2::mem1, _1, _2)(A_void_2(), 3);
assert(count == save_count+3);
save_count = count;
std::bind(&A_void_2::mem1, _2, _1)(3, A_void_2());
assert(count == save_count+3);
save_count = count;
}
}
int main()
{
test_void_1();
test_int_1();
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
#include <functional>
#include <cassert>
int count = 0;
template <class F>
void
test(F f)
{
int save_count = count;
f();
assert(count == save_count + 1);
}
template <class F>
void
test_const(const F& f)
{
int save_count = count;
f();
assert(count == save_count + 2);
}
void f() {++count;}
struct A_int_0
{
void operator()() {++count;}
void operator()() con
st {count += 2;}
};
int main()
{
test(std::bind(f));
test(std::bind(&f));
test(std::bind(A_int_0()));
test_const(std::bind(A_int_0()));
test(std::bind<void>(f));
test(std::bind<void>(&f));
test(std::bind<void>(A_int_0()));
test_const(std::bind<void>(A_int_0()));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
// unspecified bind(Fn, Types...);
#include <functional>
#include <cassert>
int count = 0;
template <class F>
void
test(F f)
{
int save_count = count;
f();
assert(count == save_count + 1);
}
template <class F>
void
test_const(const F& f)
{
int save_count = count;
f();
assert(count == save_count + 2);
}
void f() {++count;}
struct A_int_0
{
void operator()() {++count;}
void operator()() const {count += 2;}
};
int main()
{
test(std::bind(f));
test(std::bind(&f));
test(std::bind(A_int_0()));
test_const(std::bind(A_int_0()));
test(std::bind<void>(f));
test(std::bind<void>(&f));
test(std::bind<void>(A_int_0()));
test_const(std::bind<void>(A_int_0()));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<class T> struct is_bind_expression
#include <functional>
template <bool Expected, class T>
void
test(const T&)
{
static_assert(std::is_bind_expression<T>::value == Expected, "");
}
struct C {};
int main()
{
test<true>(std::bind(C()));
test<true>(std::bind(C(), std::placeholders::_2));
test<true>(std::bind<int>(C()));
test<false>(1);
test<false>(std::placeholders::_2);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<class T> struct is_bind_expression
#include <functional>
template <bool Expected, class T>
void
test(const T&)
{
static_assert(std::is_bind_expression<T>::value == Expected, "");
}
struct C {};
int main()
{
test<true>(std::bind(C()));
test<true>(std::bind(C(), std::placeholders::_2));
test<true>(std::bind<int>(C()));
test<false>(1);
test<false>(std::placeholders::_2);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// struct is_placeholder
#include <functional>
template <int Expected, class T>
void
test(const T&)
{
static_assert(std::is_placeholder<T>::value == Expected, "");
}
struct C {};
int main()
{
test<1>(std::placeholders::_1);
test<2>(std::placeholders::_2);
test<3>(std::placeholders::_3);
test<4>(std::placeholders::_4);
test<5>(std::placeholders::_5);
test<6>(std::placeholders::_6);
test<7>(std::placeholders::_7);
test<8>(std::placeholders::_8);
test<9>(std::placeholders::_9);
test<10>(std::placeholders::_10);
test<0>(4);
test<0>(5.5);
test<0>('a
');
test<0>(C());
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// struct is_placeholder
#include <functional>
template <int Expected, class T>
void
test(const T&)
{
static_assert(std::is_placeholder<T>::value == Expected, "");
}
struct C {};
int main()
{
test<1>(std::placeholders::_1);
test<2>(std::placeholders::_2);
test<3>(std::placeholders::_3);
test<4>(std::placeholders::_4);
test<5>(std::placeholders::_5);
test<6>(std::placeholders::_6);
test<7>(std::placeholders::_7);
test<8>(std::placeholders::_8);
test<9>(std::placeholders::_9);
test<10>(std::placeholders::_10);
test<0>(4);
test<0>(5.5);
test<0>('a');
test<0>(C())
;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// placeholders
#include <functional>
template <class T>
void
test(const T& t)
{
T t2;
T t3 = t;
}
int main()
{
test(std::placeholders::_1);
test(std::placeholders::_2);
test(std::placeholders::_3);
test(std::placeholders::_4);
test(std::placeholders::_5);
test(std::placeholders::_6);
test(std::placeholders::_7);
test(std::placeholders::_8);
test(std::placeholders::_9);
test(std::placeholders::_10);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// placeholders
#include <functional>
template <class T>
void
test(const T& t)
{
T t2;
T t3 = t;
}
int main()
{
test(std::placeholders::_1);
test(std::placeholders::_2);
test(std::placeholders::_3);
test(std::placeholders::_4);
test(std::placeholders::_5);
test(std::placeholders::_6);
test(std::placeholders::_7);
test(std::placeholders::_8);
test(std::placeholders::_9);
test(std::placeholders::_10);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/bind/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// bit_and
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::bit_and<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(0xEA95, 0xEA95) == 0xEA95);
assert(f(0xEA95, 0x58D3) == 0x4891);
assert(f(0x58D3, 0xEA95) == 0x4891);
assert(f(0x58D3, 0) == 0);
assert(f(0xFFFF, 0x58D3) == 0x58D3);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// bit_and
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::bit_and<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(0xEA95, 0xEA95) == 0xEA95);
assert(f(0xEA95, 0x58D3) == 0x4891);
assert(f(0x58D3, 0xEA95) == 0x4891);
assert(f(0x58D3, 0) == 0);
assert(f(0xFFFF, 0x58D3) == 0x58D3);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// bit_or
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::bit_or<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(0xEA95, 0xEA95) == 0xEA95);
assert(f(0xEA95, 0x58D3) == 0xFAD7);
assert(f(0x58D3, 0xEA95) == 0xFAD7);
assert(f(0x58D3, 0) == 0x58D3);
assert(f(0xFFFF, 0x58D3) == 0xFFFF);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// bit_or
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::bit_or<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(0xEA95, 0xEA95) == 0xEA95);
assert(f(0xEA95, 0x58D3) == 0xFAD7);
assert(f(0x58D3, 0xEA95) == 0xFAD7);
assert(f(0x58D3, 0) == 0x58D3);
assert(f(0xFFFF, 0x58D3) == 0xFFFF);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// bit_xor
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::bit_xor<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(0xEA95, 0xEA95) == 0);
assert(f(0xEA95, 0x58D3) == 0xB246);
assert(f(0x58D3, 0xEA95) == 0xB246);
assert(f(0x58D3, 0) == 0x58D3);
assert(f(0xFFFF, 0x58D3) == 0xA72C);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// bit_xor
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::bit_xor<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
assert(f(0xEA95, 0xEA95) == 0);
assert(f(0xEA95, 0x58D3) == 0xB246);
assert(f(0x58D3, 0xEA95) == 0xB246);
assert(f(0x58D3, 0) == 0x58D3);
assert(f(0xFFFF, 0x58D3) == 0xA72C);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// equal_to
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::equal_to<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(f(36, 36));
assert(!f(36, 6));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// equal_to
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::equal_to<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(f(36, 36));
assert(!f(36, 6));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// greater
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::greater<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(!f(36, 36));
assert(f(36, 6));
assert(!f(6, 36));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// greater
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::greater<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(!f(36, 36));
assert(f(36, 6));
assert(!f(6, 36));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// greater_equal
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::greater_equal<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(f(36, 36));
assert(f(36, 6));
assert(!f(6, 36));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// greater_equal
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::greater_equal<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(f(36, 36));
assert(f(36, 6));
assert(!f(6, 36));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// less
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::less<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(!f(36, 36));
assert(!f(36, 6));
assert(f(6, 36));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// less
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::less<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(!f(36, 36));
assert(!f(36, 6));
assert(f(6, 36));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// less_equal
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::less_equal<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(f(36, 36));
assert(!f(36, 6));
assert(f(6, 36));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// less_equal
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::less_equal<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(f(36, 36));
assert(!f(36, 6));
assert(f(6, 36));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// not_equal_to
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::not_equal_to<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(!f(36, 36));
assert(f(36, 6));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// not_equal_to
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::not_equal_to<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(!f(36, 36));
assert(f(36, 6));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.def/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.def/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.def/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.def/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.fail.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, class T> unspecified mem_fn(R T::* pm);
#include <functional>
#include <cassert>
struct A
{
double data_;
};
template <class F>
void
test(F f)
{
{
A a;
f(a) = 5;
assert(a.data_ == 5);
A* ap = &a;
f(ap) = 6;
assert(a.data_ == 6);
const A* cap = ap;
assert(f(cap) == f(ap));
f(cap) = 7;
}
}
int main()
{
test(std::mem_fn(&A::data_));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, class T> unspecified mem_fn(R T::* pm);
#include <functional>
#include <cassert>
struct A
{
double data_;
};
template <class F>
void
test(F f)
{
{
A a;
f(a) = 5;
assert(a.data_ == 5);
A* ap = &a;
f(ap) = 6;
assert(a.data_ == 6);
const A* cap = ap;
assert(f(cap) == f(ap));
f(cap) = 7;
}
}
int main()
{
test(std::mem_fn(&A::data_));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, class T> unspecified mem_fn(R T::* pm);
#include <functional>
#include <cassert>
struct A
{
double data_;
};
template <class F>
void
test(F f)
{
{
A a;
f(a) = 5;
assert(a.data_ == 5);
A* ap = &a;
f(ap) = 6;
assert(a.data_ == 6);
const A* cap = ap;
assert(f(cap) == f(ap));
}
}
int main()
{
test(std::mem_fn(&A::data_));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, class T> unspecified mem_fn(R T::* pm);
#include <functional>
#include <cassert>
struct A
{
double data_;
};
template <class F>
void
test(F f)
{
{
A a;
f(a) = 5;
assert(a.data_ == 5);
A* ap = &a;
f(ap) = 6;
assert(a.data_ == 6);
const A* cap = ap;
assert(f(cap) == f(ap));
}
}
int main()
{
test(std::mem_fn(&A::data_));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.memfn/member_function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.memfn/member_function.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.memfn/member_function.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.memfn/member_function.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, class T, CopyConstructible... Args>
// unspecified mem_fn(R (T::* pm)(Args...));
#include <functional>
#include <cassert>
struct A
{
char test0() {return 'a';}
char test1(int) {return 'b';}
char test2(int, double) {return 'c';}
};
template <class F>
void
test0(F f)
{
{
A a;
assert(f(a) == 'a');
A* ap = &a;
assert(f(ap) == 'a');
}
}
template <class F>
void
test1(F f)
{
{
A a;
assert(f(a, 1) == 'b');
A* ap = &a;
assert(f(ap, 2) == 'b');
}
}
template <class F>
void
test2(F f)
{
{
A a;
assert(f(a, 1, 2
) == 'c');
A* ap = &a;
assert(f(ap, 2, 3.5) == 'c');
}
}
int main()
{
test0(std::mem_fn(&A::test0));
test1(std::mem_fn(&A::test1));
test2(std::mem_fn(&A::test2));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, class T, CopyConstructible... Args>
// unspecified mem_fn(R (T::* pm)(Args...));
#include <functional>
#include <cassert>
struct A
{
char test0() {return 'a';}
char test1(int) {return 'b';}
char test2(int, double) {return 'c';}
};
template <class F>
void
test0(F f)
{
{
A a;
assert(f(a) == 'a');
A* ap = &a;
assert(f(ap) == 'a');
}
}
template <class F>
void
test1(F f)
{
{
A a;
assert(f(a, 1) == 'b');
A* ap = &a;
assert(f(ap, 2) == 'b');
}
}
template <class F>
void
test2(F f)
{
{
A a;
assert(f(a, 1, 2) == 'c');
A* ap
= &a;
assert(f(ap, 2, 3.5) == 'c');
}
}
int main()
{
test0(std::mem_fn(&A::test0));
test1(std::mem_fn(&A::test1));
test2(std::mem_fn(&A::test2));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, class T, CopyConstructible... Args>
// unspecified mem_fn(R (T::* pm)(Args...) const);
#include <functional>
#include <cassert>
struct A
{
char test0() const {return 'a';}
char test1(int) const {return 'b';}
char test2(int, double) const {return 'c';}
};
template <class F>
void
test0(F f)
{
{
A a;
assert(f(a) == 'a');
A* ap = &a;
assert(f(ap) == 'a');
const A* cap = &a;
assert(f(cap) == 'a');
}
}
template <class F>
void
test1(F f)
{
{
A a;
assert(f(a, 1) == 'b');
A* ap = &a;
assert(f(ap, 2) == 'b');
con
st A* cap = &a;
assert(f(cap, 2) == 'b');
}
}
template <class F>
void
test2(F f)
{
{
A a;
assert(f(a, 1, 2) == 'c');
A* ap = &a;
assert(f(ap, 2, 3.5) == 'c');
const A* cap = &a;
assert(f(cap, 2, 3.5) == 'c');
}
}
int main()
{
test0(std::mem_fn(&A::test0));
test1(std::mem_fn(&A::test1));
test2(std::mem_fn(&A::test2));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, class T, CopyConstructible... Args>
// unspecified mem_fn(R (T::* pm)(Args...) const);
#include <functional>
#include <cassert>
struct A
{
char test0() const {return 'a';}
char test1(int) const {return 'b';}
char test2(int, double) const {return 'c';}
};
template <class F>
void
test0(F f)
{
{
A a;
assert(f(a) == 'a');
A* ap = &a;
assert(f(ap) == 'a');
const A* cap = &a;
assert(f(cap) == 'a');
}
}
template <class F>
void
test1(F f)
{
{
A a;
assert(f(a, 1) == 'b');
A* ap = &a;
assert(f(ap, 2) == 'b');
const A* cap = &a;
assert(f(cap, 2) == 'b');
}
}
template <class F>
void
test2(F f)
{
{
A a;
assert(f(a, 1, 2) == 'c');
A* ap = &a;
assert(f(ap, 2, 3.5) == 'c');
const A* cap = &a;
assert(f(cap, 2, 3.5) == 'c');
}
}
int main()
{
test0(std::mem_fn(&A::test0));
test1(std::mem_fn(&A::test1));
test2(std::mem_fn(&A::test2));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const_volatile.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const_volatile.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const_volatile.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const_volatile.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, class T, CopyConstructible... Args>
// unspecified mem_fn(R (T::* pm)(Args...) const volatile);
#include <functional>
#include <cassert>
struct A
{
char test0() const volatile {return 'a';}
char test1(int) const volatile {return 'b';}
char test2(int, double) const volatile {return 'c';}
};
template <class F>
void
test0(F f)
{
{
A a;
assert(f(a) == 'a');
A* ap = &a;
assert(f(ap) == 'a');
const volatile A* cap = &a;
assert(f(cap) == 'a');
}
}
template <class F>
void
test1(F f)
{
{
A a;
assert(f(a, 1) == 'b');
A*
ap = &a;
assert(f(ap, 2) == 'b');
const volatile A* cap = &a;
assert(f(cap, 2) == 'b');
}
}
template <class F>
void
test2(F f)
{
{
A a;
assert(f(a, 1, 2) == 'c');
A* ap = &a;
assert(f(ap, 2, 3.5) == 'c');
const volatile A* cap = &a;
assert(f(cap, 2, 3.5) == 'c');
}
}
int main()
{
test0(std::mem_fn(&A::test0));
test1(std::mem_fn(&A::test1));
test2(std::mem_fn(&A::test2));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, class T, CopyConstructible... Args>
// unspecified mem_fn(R (T::* pm)(Args...) const volatile);
#include <functional>
#include <cassert>
struct A
{
char test0() const volatile {return 'a';}
char test1(int) const volatile {return 'b';}
char test2(int, double) const volatile {return 'c';}
};
template <class F>
void
test0(F f)
{
{
A a;
assert(f(a) == 'a');
A* ap = &a;
assert(f(ap) == 'a');
const volatile A* cap = &a;
assert(f(cap) == 'a');
}
}
template <class F>
void
test1(F f)
{
{
A a;
assert(f(a, 1) == 'b');
A* ap = &a;
assert(
f(ap, 2) == 'b');
const volatile A* cap = &a;
assert(f(cap, 2) == 'b');
}
}
template <class F>
void
test2(F f)
{
{
A a;
assert(f(a, 1, 2) == 'c');
A* ap = &a;
assert(f(ap, 2, 3.5) == 'c');
const volatile A* cap = &a;
assert(f(cap, 2, 3.5) == 'c');
}
}
int main()
{
test0(std::mem_fn(&A::test0));
test1(std::mem_fn(&A::test1));
test2(std::mem_fn(&A::test2));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_volatile.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_volatile.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_volatile.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_volatile.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, class T, CopyConstructible... Args>
// unspecified mem_fn(R (T::* pm)(Args...) volatile);
#include <functional>
#include <cassert>
struct A
{
char test0() volatile {return 'a';}
char test1(int) volatile {return 'b';}
char test2(int, double) volatile {return 'c';}
};
template <class F>
void
test0(F f)
{
{
A a;
assert(f(a) == 'a');
A* ap = &a;
assert(f(ap) == 'a');
volatile A* cap = &a;
assert(f(cap) == 'a');
}
}
template <class F>
void
test1(F f)
{
{
A a;
assert(f(a, 1) == 'b');
A* ap = &a;
assert(f(ap, 2) =
= 'b');
volatile A* cap = &a;
assert(f(cap, 2) == 'b');
}
}
template <class F>
void
test2(F f)
{
{
A a;
assert(f(a, 1, 2) == 'c');
A* ap = &a;
assert(f(ap, 2, 3.5) == 'c');
volatile A* cap = &a;
assert(f(cap, 2, 3.5) == 'c');
}
}
int main()
{
test0(std::mem_fn(&A::test0));
test1(std::mem_fn(&A::test1));
test2(std::mem_fn(&A::test2));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, class T, CopyConstructible... Args>
// unspecified mem_fn(R (T::* pm)(Args...) volatile);
#include <functional>
#include <cassert>
struct A
{
char test0() volatile {return 'a';}
char test1(int) volatile {return 'b';}
char test2(int, double) volatile {return 'c';}
};
template <class F>
void
test0(F f)
{
{
A a;
assert(f(a) == 'a');
A* ap = &a;
assert(f(ap) == 'a');
volatile A* cap = &a;
assert(f(cap) == 'a');
}
}
template <class F>
void
test1(F f)
{
{
A a;
assert(f(a, 1) == 'b');
A* ap = &a;
assert(f(ap, 2) == 'b');
volatile
A* cap = &a;
assert(f(cap, 2) == 'b');
}
}
template <class F>
void
test2(F f)
{
{
A a;
assert(f(a, 1, 2) == 'c');
A* ap = &a;
assert(f(ap, 2, 3.5) == 'c');
volatile A* cap = &a;
assert(f(cap, 2, 3.5) == 'c');
}
}
int main()
{
test0(std::mem_fn(&A::test0));
test1(std::mem_fn(&A::test1));
test2(std::mem_fn(&A::test2));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.require/binary_function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.require/binary_function.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.require/binary_function.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.require/binary_function.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// binary_function
#include <functional>
#include <type_traits>
int main()
{
typedef std::binary_function<int, short, bool> bf;
static_assert((std::is_same<bf::first_argument_type, int>::value), "");
static_assert((std::is_same<bf::second_argument_type, short>::value), "");
static_assert((std::is_same<bf::result_type, bool>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// binary_function
#include <functional>
#include <type_traits>
int main()
{
typedef std::binary_function<int, short, bool> bf;
static_assert((std::is_same<bf::first_argument_type, int>::value), "");
static_assert((std::is_same<bf::second_argument_type, short>::value), "");
static_assert((std::is_same<bf::result_type, bool>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.require/unary_function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.require/unary_function.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.require/unary_function.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.require/unary_function.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// unary_function
#include <functional>
#include <type_traits>
int main()
{
typedef std::unary_function<int, bool> uf;
static_assert((std::is_same<uf::argument_type, int>::value), "");
static_assert((std::is_same<uf::result_type, bool>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// unary_function
#include <functional>
#include <type_traits>
int main()
{
typedef std::unary_function<int, bool> uf;
static_assert((std::is_same<uf::argument_type, int>::value), "");
static_assert((std::is_same<uf::result_type, bool>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// Class bad_function_call
// class bad_function_call
// : public exception
// {
// public:
// // 20.7.16.1.1, constructor:
// bad_function_call();
// };
#include <functional>
#include <type_traits>
int main()
{
static_assert((std::is_base_of<std::exception, std::bad_function_call>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// Class bad_function_call
// class bad_function_call
// : public exception
// {
// public:
// // 20.7.16.1.1, constructor:
// bad_function_call();
// };
#include <functional>
#include <type_traits>
int main()
{
static_assert((std::is_base_of<std::exception, std::bad_function_call>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// Class bad_function_call
// bad_function_call();
#include <functional>
#include <type_traits>
int main()
{
std::bad_function_call ex;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// Class bad_function_call
// bad_function_call();
#include <functional>
#include <type_traits>
int main()
{
std::bad_function_call ex;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
explicit A(int j)
{
++count;
data_[0] = j;
}
A(const A& a)
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = a.data_[i];
}
~A() {--count;}
int operator()(int i) const
{
for (int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
int id() const {return data_[0];}
};
int A::count = 0;
int g(int) {return 0;}
int h(int) {return 1;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f1 = A(1);
std::function<int(int)> f2 = A(2);
assert(A::count == 2);
assert(new_called == 2);
assert(f1.target<A>()->id() == 1);
assert(f2.target<A>()->id() == 2);
swap(f1, f2);
assert(A::count == 2);
assert(new_called == 2);
assert(f1.target<A>()->id() == 2);
assert(f2.target<A>()->id() == 1);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f1 = A(1);
std::function<int(int)> f2 = g;
assert(A::count == 1);
assert(new_called == 1);
assert(f1.target<
A>()->id() == 1);
assert(*f2.target<int(*)(int)>() == g);
swap(f1, f2);
assert(A::count == 1);
assert(new_called == 1);
assert(*f1.target<int(*)(int)>() == g);
assert(f2.target<A>()->id() == 1);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f1 = g;
std::function<int(int)> f2 = A(1);
assert(A::count == 1);
assert(new_called == 1);
assert(*f1.target<int(*)(int)>() == g);
assert(f2.target<A>()->id() == 1);
swap(f1, f2);
assert(A::count == 1);
assert(new_called == 1);
assert(f1.target<A>()->id() == 1);
assert(*f2.target<int(*)(int)>() == g);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f1 = g;
std::function<int(int)> f2 = h;
assert(A::count == 0);
assert(new_called == 0);
assert(*f1.target<int(*)(int)>() == g);
assert(*f2.target<int(*)(int)>() == h);
swap(f1, f2);
assert(A::count == 0);
assert(new_called == 0);
assert(*f1.target<int(*)(int)>() == h);
assert(*f2.target<int(*)(int)>() == g);
}
assert(A::count == 0);
assert(new_called == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
explicit A(int j)
{
++count;
data_[0] = j;
}
A(const A& a)
{
++count
;
for (int i = 0; i < 10; ++i)
data_[i] = a.data_[i];
}
~A() {--count;}
int operator()(int i) const
{
for (int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
int id() const {return data_[0];}
};
int A::count = 0;
int g(int) {return 0;}
int h(int) {return 1;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f1 = A(1);
std::function<int(int)> f2 = A(2);
assert(A::count == 2);
assert(new_called == 2);
assert(f1.target<A>()->id() == 1);
assert(f2.target<A>()->id() == 2);
swap(f1, f2);
assert(A::count == 2);
assert(new_called == 2);
assert(f1.target<A>()->id() == 2);
assert(f2.target<A>()->id() == 1);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f1 = A(1);
std::function<int(int)> f2 = g;
assert(A::count == 1);
assert(new_called == 1);
assert(f1.target<A>()->id() == 1);
assert(*f2.target<int(*)(int)>() == g);
swap(f1, f2);
assert(A::count == 1);
assert(new_called == 1);
assert(*f1.target<int(*)(int)>() == g);
assert(f2.target<A>()->id() == 1);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f1 = g;
std::function<int(int)> f2 = A(1);
assert(A::count == 1);
assert(new_called == 1);
assert(*f1.target<int(*)(int)>() == g);
assert(f2.target<A>()->id() == 1);
swap(f1, f2);
assert(A::count == 1);
assert(new_called == 1);
assert(f1.target<A>()->id() == 1);
assert(*f2.target<int(*)(int)>() == g);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f1 = g;
std::function<int(int)> f2 = h;
assert(A::count == 0);
assert(new_called == 0);
assert(*f1.target<int(*)(int)>() == g);
assert(*f2.target<int(*)(int)>() == h);
swap(f1, f2);
assert(A::count == 0);
assert(new_called
== 0);
assert(*f1.target<int(*)(int)>() == h);
assert(*f2.target<int(*)(int)>() == g);
}
assert(A::count == 0);
assert(new_called == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// explicit operator bool() const
#include <functional>
#include <cassert>
int g(int) {return 0;}
int main()
{
{
std::function<int(int)> f;
assert(!f);
f = g;
assert(f);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// explicit operator bool() const
#include <functional>
#include <cassert>
int g(int) {return 0;}
int main()
{
{
std::function<int(int)> f;
assert(!f);
f = g;
assert(f);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// function(nullptr_t);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A() {--count;}
int operator()(int i) const
{
for (int j
= 0; j < 10; ++j)
i += data_[j];
return i;
}
int foo(int) const {return 1;}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f = g;
assert(new_called == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
}
assert(new_called == 0);
{
std::function<int(int)> f = (int (*)(int))0;
assert(!f);
assert(new_called == 0);
assert(f.target<int(*)(int)>() == 0);
assert(f.target<A>() == 0);
}
{
std::function<int(const A*, int)> f = &A::foo;
assert(f);
assert(new_called == 0);
assert(f.target<int (A::*)(int) const>() != 0);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// function(nullptr_t);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A() {--count;}
int operator()(int i) const
{
for (int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
int foo(int) const {return 1;}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f = g;
assert(new_called == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
}
assert(new_called == 0);
{
std::function<int(int)> f = (int (*)(int))0;
assert(!f);
assert(new_called == 0);
assert(f.target<int(*)(int)>() == 0);
assert(f.target<A>() == 0);
}
{
std::function<int(const A*, int)> f = &A::foo;
assert(f);
assert(new_called == 0);
assert(f.target<int (A::*)(int) const>() != 0);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// template<class F>
// requires CopyConstructible<F> && Callable<F, ArgTypes..>
// && Convertible<Callable<F, ArgTypes...>::result_type
// operator=(F f);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 1
0; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A() {--count;}
int operator()(int i) const
{
for (int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
int foo(int) const {return 1;}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f;
f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f;
f = g;
assert(new_called == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
}
assert(new_called == 0);
{
std::function<int(int)> f;
f = (int (*)(int))0;
assert(!f);
assert(new_called == 0);
assert(f.target<int(*)(int)>() == 0);
assert(f.target<A>() == 0);
}
{
std::function<int(const A*, int)>
f;
f = &A::foo;
assert(f);
assert(new_called == 0);
assert(f.target<int (A::*)(int) const>() != 0);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// template<class F>
// requires CopyConstructible<F> && Callable<F, ArgTypes..>
// && Convertible<Callable<F, ArgTypes...>::result_type
// operator=(F f);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A() {--count;}
int operator()(int i) const
{
for (int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
int foo(int) const {return 1;}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f;
f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f;
f = g;
assert(new_called == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
}
assert(new_called == 0);
{
std::function<int(int)> f;
f = (int (*)(int))0;
assert(!f);
assert(new_called == 0);
assert(f.target<int(*)(int)>() == 0);
assert(f.target<A>() == 0);
}
{
std::function<int(const A*, int)> f;
f = &A::foo;
assert(f);
assert(new_called == 0);
assert(f.target<int (A::*)(int) const>() != 0);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// function(const function& f);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A() {--count;}
int operator()(int i) const
{
for
(int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
std::function<int(int)> f2 = f;
assert(A::count == 2);
assert(new_called == 2);
assert(f2.target<A>());
assert(f2.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f = g;
assert(new_called == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
std::function<int(int)> f2 = f;
assert(new_called == 0);
assert(f2.target<int(*)(int)>());
assert(f2.target<A>() == 0);
}
assert(new_called == 0);
{
std::function<int(int)> f;
assert(new_called == 0);
assert(f.target<int(*)(int)>() == 0);
assert(f
.target<A>() == 0);
std::function<int(int)> f2 = f;
assert(new_called == 0);
assert(f2.target<int(*)(int)>() == 0);
assert(f2.target<A>() == 0);
}
#ifdef _LIBCPP_MOVE
assert(new_called == 0);
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
std::function<int(int)> f2 = _STD::move(f);
assert(A::count == 1);
assert(new_called == 1);
assert(f2.target<A>());
assert(f2.target<int(*)(int)>() == 0);
assert(f.target<A>() == 0);
assert(f.target<int(*)(int)>() == 0);
}
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// function(const function& f);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A() {--count;}
int operator()(int i) const
{
for (int j = 0; j < 10;
++j)
i += data_[j];
return i;
}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
std::function<int(int)> f2 = f;
assert(A::count == 2);
assert(new_called == 2);
assert(f2.target<A>());
assert(f2.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f = g;
assert(new_called == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
std::function<int(int)> f2 = f;
assert(new_called == 0);
assert(f2.target<int(*)(int)>());
assert(f2.target<A>() == 0);
}
assert(new_called == 0);
{
std::function<int(int)> f;
assert(new_called == 0);
assert(f.target<int(*)(int)>() == 0);
assert(f.target<A>() == 0);
std::function<int(int)> f2 = f;
assert(new_called == 0);
assert(f2.target<int(*)(int)>() == 0);
assert(f2.target<A>() == 0);
}
#ifdef _LIBCPP_MOVE
assert(new_called == 0);
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
std::function<int(int)> f2 = _STD::move(f);
assert(A::count == 1);
assert(new_called == 1);
assert(f2.target<A>());
assert(f2.target<int(*)(int)>() == 0);
assert(f.target<A>() == 0);
assert(f.target<int(*)(int)>() == 0);
}
#endif
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// function& operator=(const function& f);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A() {--count;}
int operator()(int i) const
{
for (int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
std::function<int(int)> f2;
f2 = f;
assert(A::count == 2);
assert(new_called == 2);
assert(f2.target<A>());
assert(f2.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f = g;
assert(new_called == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
std::function<int(int)> f2;
f2 = f;
assert(new_called == 0);
assert(f2.target<int(*)(int)>());
assert(f2.target<A>() == 0);
}
assert(new_called == 0);
{
std::function<int(int)> f;
assert(new_called == 0);
assert(f.target<int(*)(
int)>() == 0);
assert(f.target<A>() == 0);
std::function<int(int)> f2;
f2 = f;
assert(new_called == 0);
assert(f2.target<int(*)(int)>() == 0);
assert(f2.target<A>() == 0);
}
#ifdef _LIBCPP_MOVE
assert(new_called == 0);
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
std::function<int(int)> f2;
f2 = _STD::move(f);
assert(A::count == 1);
assert(new_called == 1);
assert(f2.target<A>());
assert(f2.target<int(*)(int)>() == 0);
assert(f.target<A>() == 0);
assert(f.target<int(*)(int)>() == 0);
}
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// function& operator=(const function& f);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A() {--count;}
int operator()(int i) const
{
for (int j =
0; j < 10; ++j)
i += data_[j];
return i;
}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
std::function<int(int)> f2;
f2 = f;
assert(A::count == 2);
assert(new_called == 2);
assert(f2.target<A>());
assert(f2.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f = g;
assert(new_called == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
std::function<int(int)> f2;
f2 = f;
assert(new_called == 0);
assert(f2.target<int(*)(int)>());
assert(f2.target<A>() == 0);
}
assert(new_called == 0);
{
std::function<int(int)> f;
assert(new_called == 0);
assert(f.target<int(*)(int)>() == 0);
a
ssert(f.target<A>() == 0);
std::function<int(int)> f2;
f2 = f;
assert(new_called == 0);
assert(f2.target<int(*)(int)>() == 0);
assert(f2.target<A>() == 0);
}
#ifdef _LIBCPP_MOVE
assert(new_called == 0);
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
std::function<int(int)> f2;
f2 = _STD::move(f);
assert(A::count == 1);
assert(new_called == 1);
assert(f2.target<A>());
assert(f2.target<int(*)(int)>() == 0);
assert(f.target<A>() == 0);
assert(f.target<int(*)(int)>() == 0);
}
#endif
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// explicit function();
#include <functional>
#include <cassert>
int main()
{
std::function<int(int)> f;
assert(!f);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// explicit function();
#include <functional>
#include <cassert>
int main()
{
std::function<int(int)> f;
assert(!f);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// function(nullptr_t);
#include <functional>
#include <cassert>
int main()
{
std::function<int(int)> f(nullptr);
assert(!f);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// function(nullptr_t);
#include <functional>
#include <cassert>
int main()
{
std::function<int(int)> f(nullptr);
assert(!f);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// function& operator=(nullptr_t);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A() {--count;}
int operator()(int i) const
{
for (int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
f = nullptr;
assert(A::count == 0);
assert(new_called == 0);
assert(f.target<A>() == 0);
}
{
std::function<int(int)> f = g;
assert(new_called == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
f = nullptr;
assert(new_called == 0);
assert(f.target<int(*)(int)>() == 0);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// function& operator=(nullptr_t);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A() {--count;}
int operator()(int i) const
{
for (int j = 0; j <
10; ++j)
i += data_[j];
return i;
}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(new_called == 1);
assert(f.target<A>());
f = nullptr;
assert(A::count == 0);
assert(new_called == 0);
assert(f.target<A>() == 0);
}
{
std::function<int(int)> f = g;
assert(new_called == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
f = nullptr;
assert(new_called == 0);
assert(f.target<int(*)(int)>() == 0);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// R operator()(ArgTypes... args) const
#include <functional>
#include <cassert>
// member data pointer: cv qualifiers should transfer from argument to return type
struct A_int_1
{
A_int_1() : data_(5) {}
int data_;
};
void
test_int_1()
{
// member data pointer
{
int A_int_1::*fp = &A_int_1::data_;
A_int_1 a;
std::function<int& (const A_int_1*)> r2(fp);
const A_int_1* ap = &a;
assert(r2(ap) == 6);
r2(ap) = 7;
assert(r2(ap) == 7);
}
}
int main()
{
test_int_1();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// R operator()(ArgTypes... args) const
#include <functional>
#include <cassert>
// member data pointer: cv qualifiers should transfer from argument to return type
struct A_int_1
{
A_int_1() : data_(5) {}
int data_;
};
void
test_int_1()
{
// member data pointer
{
int A_int_1::*fp = &A_int_1::data_;
A_int_1 a;
std::function<int& (const A_int_1*)> r2(fp);
const A_int_1* ap = &a;
assert(r2(ap) == 6);
r2(ap) = 7;
assert(r2(ap) == 7);
}
}
int main()
{
test_int_1();
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// R operator()(ArgTypes... args) const
#include <functional>
#include <cassert>
int count = 0;
// 1 arg, return void
void f_void_1(int i)
{
count += i;
}
struct A_void_1
{
void operator()(int i)
{
count += i;
}
void mem1() {++count;}
void mem2() const {++count;}
};
void
test_void_1()
{
int save_count = count;
// function
{
std::function<void (int)> r1(f_void_1);
int i = 2;
r1(i);
assert(count == save_count+2);
save_count = count;
}
// function pointer
{
void (*fp)(int) = f_void_1;
std::function<void (int)> r1(fp);
int i = 3;
r1(i);
assert(count == save_count+3);
save_count = count;
}
// functor
{
A_void_1 a0;
std::function<void (int)> r1(a0);
int i = 4;
r1(i);
assert(count == save_count+4);
save_count = count;
}
// member function pointer
{
void (A_void_1::*fp)() = &A_void_1::mem1;
std::function<void (A_void_1)> r1(fp);
A_void_1 a;
r1(a);
assert(count == save_count+1);
save_count = count;
A_void_1* ap = &a;
std::function<void (A_void_1*)> r2 = fp;
r2(ap);
assert(count == save_count+1);
save_count = count;
}
// const member function pointer
{
void (A_void_1::*fp)() const = &A_void_1::mem2;
std::function<void (A_void_1)> r1(fp);
A_void_1 a;
r1(a);
assert(count == save_count+1);
save_count = count;
std::function<void (A_void_1*)> r2(fp);
A_void_1* ap = &a;
r2(ap);
assert(count == save_count+1);
save_count = count;
}
}
// 1 arg, return int
int f_int_1(int i)
{
return i + 1;
}
struct A_int_1
{
A_int_1() : data_(5) {}
int operator()(int i)
{
return i - 1;
}
int mem1() {return 3;}
int mem2() const {return 4;}
int data_;
};
void
test_int_1()
{
// function
{
std::function<int (int)> r1(f_int_1);
int i = 2;
assert(r1(i) == 3);
}
// function pointer
{
int (*fp)(int) = f_int_1;
std::function<int (int)> r1(fp);
int i = 3;
assert(r1(i) == 4);
}
// functor
{
A_int_1 a0;
std::function<int (int)> r1(a0);
int i = 4;
assert(r1(i) == 3);
}
// member function pointer
{
int (A_int_1::*fp)() = &A_int_1::mem1;
std::function<int (A_int_1)> r1(fp);
A_int_1 a;
assert(r1(a) == 3);
std::function<int (A_int_1*)> r2(fp);
A_int_1* ap = &a;
assert(r2(ap) == 3);
}
// const member function pointer
{
int (A_int_1::
*fp)() const = &A_int_1::mem2;
std::function<int (A_int_1)> r1(fp);
A_int_1 a;
assert(r1(a) == 4);
std::function<int (A_int_1*)> r2(fp);
A_int_1* ap = &a;
assert(r2(ap) == 4);
}
// member data pointer
{
int A_int_1::*fp = &A_int_1::data_;
std::function<int& (A_int_1&)> r1(fp);
A_int_1 a;
assert(r1(a) == 5);
r1(a) = 6;
assert(r1(a) == 6);
std::function<int& (A_int_1*)> r2(fp);
A_int_1* ap = &a;
assert(r2(ap) == 6);
r2(ap) = 7;
assert(r2(ap) == 7);
}
}
// 2 arg, return void
void f_void_2(int i, int j)
{
count += i+j;
}
struct A_void_2
{
void operator()(int i, int j)
{
count += i+j;
}
void mem1(int i) {count += i;}
void mem2(int i) const {count += i;}
};
void
test_void_2()
{
int save_count = count;
// function
{
std::function<void (int, int)> r1(f_void_2);
int i = 2;
int j = 3;
r1(i, j);
assert(count == save_count+5);
save_
count = count;
}
// function pointer
{
void (*fp)(int, int) = f_void_2;
std::function<void (int, int)> r1(fp);
int i = 3;
int j = 4;
r1(i, j);
assert(count == save_count+7);
save_count = count;
}
// functor
{
A_void_2 a0;
std::function<void (int, int)> r1(a0);
int i = 4;
int j = 5;
r1(i, j);
assert(count == save_count+9);
save_count = count;
}
// member function pointer
{
void (A_void_2::*fp)(int) = &A_void_2::mem1;
std::function<void (A_void_2, int)> r1(fp);
A_void_2 a;
int i = 3;
r1(a, i);
assert(count == save_count+3);
save_count = count;
std::function<void (A_void_2*, int)> r2(fp);
A_void_2* ap = &a;
r2(ap, i);
assert(count == save_count+3);
save_count = count;
}
// const member function pointer
{
void (A_void_2::*fp)(int) const = &A_void_2::mem2;
std::function<void (A_void_2, int)> r1(fp);
A_void_2 a;
int
i = 4;
r1(a, i);
assert(count == save_count+4);
save_count = count;
std::function<void (A_void_2*, int)> r2(fp);
A_void_2* ap = &a;
r2(ap, i);
assert(count == save_count+4);
save_count = count;
}
}
// 2 arg, return int
int f_int_2(int i, int j)
{
return i+j;
}
struct A_int_2
{
int operator()(int i, int j)
{
return i+j;
}
int mem1(int i) {return i+1;}
int mem2(int i) const {return i+2;}
};
void
testint_2()
{
// function
{
std::function<int (int, int)> r1(f_int_2);
int i = 2;
int j = 3;
assert(r1(i, j) == i+j);
}
// function pointer
{
int (*fp)(int, int) = f_int_2;
std::function<int (int, int)> r1(fp);
int i = 3;
int j = 4;
assert(r1(i, j) == i+j);
}
// functor
{
A_int_2 a0;
std::function<int (int, int)> r1(a0);
int i = 4;
int j = 5;
assert(r1(i, j) == i+j);
}
// member function pointer
{
int(A_int_2::
*fp)(int) = &A_int_2::mem1;
std::function<int (A_int_2, int)> r1(fp);
A_int_2 a;
int i = 3;
assert(r1(a, i) == i+1);
std::function<int (A_int_2*, int)> r2(fp);
A_int_2* ap = &a;
assert(r2(ap, i) == i+1);
}
// const member function pointer
{
int (A_int_2::*fp)(int) const = &A_int_2::mem2;
std::function<int (A_int_2, int)> r1(fp);
A_int_2 a;
int i = 4;
assert(r1(a, i) == i+2);
std::function<int (A_int_2*, int)> r2(fp);
A_int_2* ap = &a;
assert(r2(ap, i) == i+2);
}
}
int main()
{
test_void_1();
test_int_1();
test_void_2();
testint_2();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// R operator()(ArgTypes... args) const
#include <functional>
#include <cassert>
int count = 0;
// 1 arg, return void
void f_void_1(int i)
{
count += i;
}
struct A_void_1
{
void operator()(int i)
{
count += i;
}
void mem1() {++count;}
void mem2() const {++count;}
};
void
test_void_1()
{
int save_count = count;
// function
{
std::function<void (int)> r1(f_void_1);
int i = 2;
r1(i);
assert(count == save_count+2);
save_count = count;
}
// function pointer
{
void (*fp)(int) = f_void_1;
std::function<voi
d (int)> r1(fp);
int i = 3;
r1(i);
assert(count == save_count+3);
save_count = count;
}
// functor
{
A_void_1 a0;
std::function<void (int)> r1(a0);
int i = 4;
r1(i);
assert(count == save_count+4);
save_count = count;
}
// member function pointer
{
void (A_void_1::*fp)() = &A_void_1::mem1;
std::function<void (A_void_1)> r1(fp);
A_void_1 a;
r1(a);
assert(count == save_count+1);
save_count = count;
A_void_1* ap = &a;
std::function<void (A_void_1*)> r2 = fp;
r2(ap);
assert(count == save_count+1);
save_count = count;
}
// const member function pointer
{
void (A_void_1::*fp)() const = &A_void_1::mem2;
std::function<void (A_void_1)> r1(fp);
A_void_1 a;
r1(a);
assert(count == save_count+1);
save_count = count;
std::function<void (A_void_1*)> r2(fp);
A_void_1* ap = &a;
r2(ap);
assert(count == save_count+1);
save_count = co
unt;
}
}
// 1 arg, return int
int f_int_1(int i)
{
return i + 1;
}
struct A_int_1
{
A_int_1() : data_(5) {}
int operator()(int i)
{
return i - 1;
}
int mem1() {return 3;}
int mem2() const {return 4;}
int data_;
};
void
test_int_1()
{
// function
{
std::function<int (int)> r1(f_int_1);
int i = 2;
assert(r1(i) == 3);
}
// function pointer
{
int (*fp)(int) = f_int_1;
std::function<int (int)> r1(fp);
int i = 3;
assert(r1(i) == 4);
}
// functor
{
A_int_1 a0;
std::function<int (int)> r1(a0);
int i = 4;
assert(r1(i) == 3);
}
// member function pointer
{
int (A_int_1::*fp)() = &A_int_1::mem1;
std::function<int (A_int_1)> r1(fp);
A_int_1 a;
assert(r1(a) == 3);
std::function<int (A_int_1*)> r2(fp);
A_int_1* ap = &a;
assert(r2(ap) == 3);
}
// const member function pointer
{
int (A_int_1::*fp)() const = &A_in
t_1::mem2;
std::function<int (A_int_1)> r1(fp);
A_int_1 a;
assert(r1(a) == 4);
std::function<int (A_int_1*)> r2(fp);
A_int_1* ap = &a;
assert(r2(ap) == 4);
}
// member data pointer
{
int A_int_1::*fp = &A_int_1::data_;
std::function<int& (A_int_1&)> r1(fp);
A_int_1 a;
assert(r1(a) == 5);
r1(a) = 6;
assert(r1(a) == 6);
std::function<int& (A_int_1*)> r2(fp);
A_int_1* ap = &a;
assert(r2(ap) == 6);
r2(ap) = 7;
assert(r2(ap) == 7);
}
}
// 2 arg, return void
void f_void_2(int i, int j)
{
count += i+j;
}
struct A_void_2
{
void operator()(int i, int j)
{
count += i+j;
}
void mem1(int i) {count += i;}
void mem2(int i) const {count += i;}
};
void
test_void_2()
{
int save_count = count;
// function
{
std::function<void (int, int)> r1(f_void_2);
int i = 2;
int j = 3;
r1(i, j);
assert(count == save_count+5);
save_count = count;
}
// function pointer
{
void (*fp)(int, int) = f_void_2;
std::function<void (int, int)> r1(fp);
int i = 3;
int j = 4;
r1(i, j);
assert(count == save_count+7);
save_count = count;
}
// functor
{
A_void_2 a0;
std::function<void (int, int)> r1(a0);
int i = 4;
int j = 5;
r1(i, j);
assert(count == save_count+9);
save_count = count;
}
// member function pointer
{
void (A_void_2::*fp)(int) = &A_void_2::mem1;
std::function<void (A_void_2, int)> r1(fp);
A_void_2 a;
int i = 3;
r1(a, i);
assert(count == save_count+3);
save_count = count;
std::function<void (A_void_2*, int)> r2(fp);
A_void_2* ap = &a;
r2(ap, i);
assert(count == save_count+3);
save_count = count;
}
// const member function pointer
{
void (A_void_2::*fp)(int) const = &A_void_2::mem2;
std::function<void (A_void_2, int)> r1(fp);
A_void_2 a;
int i = 4;
r1(a, i)
;
assert(count == save_count+4);
save_count = count;
std::function<void (A_void_2*, int)> r2(fp);
A_void_2* ap = &a;
r2(ap, i);
assert(count == save_count+4);
save_count = count;
}
}
// 2 arg, return int
int f_int_2(int i, int j)
{
return i+j;
}
struct A_int_2
{
int operator()(int i, int j)
{
return i+j;
}
int mem1(int i) {return i+1;}
int mem2(int i) const {return i+2;}
};
void
testint_2()
{
// function
{
std::function<int (int, int)> r1(f_int_2);
int i = 2;
int j = 3;
assert(r1(i, j) == i+j);
}
// function pointer
{
int (*fp)(int, int) = f_int_2;
std::function<int (int, int)> r1(fp);
int i = 3;
int j = 4;
assert(r1(i, j) == i+j);
}
// functor
{
A_int_2 a0;
std::function<int (int, int)> r1(a0);
int i = 4;
int j = 5;
assert(r1(i, j) == i+j);
}
// member function pointer
{
int(A_int_2::*fp)(int) = &A_int_2
::mem1;
std::function<int (A_int_2, int)> r1(fp);
A_int_2 a;
int i = 3;
assert(r1(a, i) == i+1);
std::function<int (A_int_2*, int)> r2(fp);
A_int_2* ap = &a;
assert(r2(ap, i) == i+1);
}
// const member function pointer
{
int (A_int_2::*fp)(int) const = &A_int_2::mem2;
std::function<int (A_int_2, int)> r1(fp);
A_int_2 a;
int i = 4;
assert(r1(a, i) == i+2);
std::function<int (A_int_2*, int)> r2(fp);
A_int_2* ap = &a;
assert(r2(ap, i) == i+2);
}
}
int main()
{
test_void_1();
test_int_1();
test_void_2();
testint_2();
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_int_0.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_int_0.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_int_0.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_int_0.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// R operator()(ArgTypes... args) const
#include <functional>
#include <cassert>
// 0 args, return int
int count = 0;
int f_int_0()
{
return 3;
}
struct A_int_0
{
int operator()() {return 4;}
};
void
test_int_0()
{
// function
{
std::function<int ()> r1(f_int_0);
assert(r1() == 3);
}
// function pointer
{
int (*fp)() = f_int_0;
std::function<int ()> r1(fp);
assert(r1() == 3);
}
// functor
{
A_int_0 a0;
std::function<int ()> r1(a0);
assert(r1() == 4);
}
}
int main()
{
test_int_0();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// R operator()(ArgTypes... args) const
#include <functional>
#include <cassert>
// 0 args, return int
int count = 0;
int f_int_0()
{
return 3;
}
struct A_int_0
{
int operator()() {return 4;}
};
void
test_int_0()
{
// function
{
std::function<int ()> r1(f_int_0);
assert(r1() == 3);
}
// function pointer
{
int (*fp)() = f_int_0;
std::function<int ()> r1(fp);
assert(r1() == 3);
}
// functor
{
A_int_0 a0;
std::function<int ()> r1(a0);
assert(r1() == 4);
}
}
int main()
{
test_int_0();
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_void_0.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_void_0.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_void_0.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_void_0.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// R operator()(ArgTypes... args) const
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
// 0 args, return void
int count = 0;
void f_void_0()
{
++count;
}
struct A_void_0
{
void operator()() {++count;}
};
void
test_void_0()
{
int save_count = count;
// function
{
std::function<void ()> r1(f_void_0);
r1();
assert(count == save_count+1);
save_count = count;
}
// function pointer
{
void (*fp)() = f_void_0;
std::function<void ()> r1(fp);
r1();
assert(count == save_count+1);
save_count = count;
}
// functor
{
A_void_0 a0;
std::function<void ()> r1(a0);
r1();
assert(count == save_count+1);
save_count = count;
}
}
int main()
{
test_void_0();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// R operator()(ArgTypes... args) const
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
// 0 args, return void
int count = 0;
void f_void_0()
{
++count;
}
struct A_void_0
{
void operator()() {++count;}
};
void
test_void_0()
{
int save_count = count;
// function
{
std::function<void ()> r1(f_void_0);
r1();
assert(count == save_count+1);
save_count = count;
}
// function pointer
{
void (*fp)() = f_void_0;
std::function<void ()> r1(fp);
r1();
assert(count == save_count+1);
save_count = count;
}
// functor
{
A_void_0 a0;
std::function<void ()> r1(a0);
r1();
assert(count == save_count+1);
save_count = count;
}
}
int main()
{
test_void_0();
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/assign_F_alloc.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// void swap(function& other);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
explicit A(int j)
{
++count;
data_[0] = j;
}
A(const A& a)
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = a.data_[i];
}
~A
() {--count;}
int operator()(int i) const
{
for (int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
int id() const {return data_[0];}
};
int A::count = 0;
int g(int) {return 0;}
int h(int) {return 1;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f1 = A(1);
std::function<int(int)> f2 = A(2);
assert(A::count == 2);
assert(new_called == 2);
assert(f1.target<A>()->id() == 1);
assert(f2.target<A>()->id() == 2);
f1.swap(f2);
assert(A::count == 2);
assert(new_called == 2);
assert(f1.target<A>()->id() == 2);
assert(f2.target<A>()->id() == 1);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f1 = A(1);
std::function<int(int)> f2 = g;
assert(A::count == 1);
assert(new_called == 1);
assert(f1.target<A>()->id() == 1);
assert(*f2.target<int(*)(int)>() == g);
f1.swap(f2);
assert(A::count == 1);
assert(new_called == 1);
assert(*f1.target<int(*)(int)>() == g);
assert(f2.target<A>()->id() == 1);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f1 = g;
std::function<int(int)> f2 = A(1);
assert(A::count == 1);
assert(new_called == 1);
assert(*f1.target<int(*)(int)>() == g);
assert(f2.target<A>()->id() == 1);
f1.swap(f2);
assert(A::count == 1);
assert(new_called == 1);
assert(f1.target<A>()->id() == 1);
assert(*f2.target<int(*)(int)>() == g);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f1 = g;
std::function<int(int)> f2 = h;
assert(A::count == 0);
assert(new_called == 0);
assert(*f1.target<int(*)(int)>() == g);
assert(*f2.target<int(*)(int)>() == h);
f1.swap(f2);
assert(A::count == 0);
assert(new_called == 0);
assert(*f1.target<int(*)(int)>() == h);
assert(*f2.target<int(*)(int)>() ==
g);
}
assert(A::count == 0);
assert(new_called == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// void swap(function& other);
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
class A
{
int data_[10];
public:
static int count;
explicit A(int j)
{
++count;
data_[0] = j;
}
A(const A& a)
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = a.data_[i];
}
~A() {--count;}
i
nt operator()(int i) const
{
for (int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
int id() const {return data_[0];}
};
int A::count = 0;
int g(int) {return 0;}
int h(int) {return 1;}
int main()
{
assert(new_called == 0);
{
std::function<int(int)> f1 = A(1);
std::function<int(int)> f2 = A(2);
assert(A::count == 2);
assert(new_called == 2);
assert(f1.target<A>()->id() == 1);
assert(f2.target<A>()->id() == 2);
f1.swap(f2);
assert(A::count == 2);
assert(new_called == 2);
assert(f1.target<A>()->id() == 2);
assert(f2.target<A>()->id() == 1);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f1 = A(1);
std::function<int(int)> f2 = g;
assert(A::count == 1);
assert(new_called == 1);
assert(f1.target<A>()->id() == 1);
assert(*f2.target<int(*)(int)>() == g);
f1.swap(f2);
assert(A::count == 1);
assert(new_called
== 1);
assert(*f1.target<int(*)(int)>() == g);
assert(f2.target<A>()->id() == 1);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f1 = g;
std::function<int(int)> f2 = A(1);
assert(A::count == 1);
assert(new_called == 1);
assert(*f1.target<int(*)(int)>() == g);
assert(f2.target<A>()->id() == 1);
f1.swap(f2);
assert(A::count == 1);
assert(new_called == 1);
assert(f1.target<A>()->id() == 1);
assert(*f2.target<int(*)(int)>() == g);
}
assert(A::count == 0);
assert(new_called == 0);
{
std::function<int(int)> f1 = g;
std::function<int(int)> f2 = h;
assert(A::count == 0);
assert(new_called == 0);
assert(*f1.target<int(*)(int)>() == g);
assert(*f2.target<int(*)(int)>() == h);
f1.swap(f2);
assert(A::count == 0);
assert(new_called == 0);
assert(*f1.target<int(*)(int)>() == h);
assert(*f2.target<int(*)(int)>() == g);
}
assert
(A::count == 0);
assert(new_called == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_==.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_%3D%3D.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_==.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_==.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// bool operator==(const function<R(ArgTypes...)>&, nullptr_t);
//
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// bool operator==(nullptr_t, const function<R(ArgTypes...)>&);
//
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// bool operator!=(const function<R(ArgTypes...)>&, nullptr_t);
//
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// bool operator!=(nullptr_t, const function<R(ArgTypes...)>&);
#include <functional>
#in
clude <cassert>
int g(int) {return 0;}
int main()
{
{
std::function<int(int)> f;
assert(f == nullptr);
assert(nullptr == f);
f = g;
assert(f != nullptr);
assert(nullptr != f);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// bool operator==(const function<R(ArgTypes...)>&, nullptr_t);
//
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// bool operator==(nullptr_t, const function<R(ArgTypes...)>&);
//
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// bool operator!=(const function<R(ArgTypes...)>&, nullptr_t);
//
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
// bool operator!=(nullptr_t, const function<R(ArgTypes...)>&);
#include <functional>
#include <cassert>
int
g(int) {return 0;}
int main()
{
{
std::function<int(int)> f;
assert(f == nullptr);
assert(nullptr == f);
f = g;
assert(f != nullptr);
assert(nullptr != f);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// template<typename T>
// requires Callable<T, ArgTypes...> && Convertible<Callable<T, ArgTypes...>::result_type, R>
// T*
// target();
// template<typename T>
// requires Callable<T, ArgTypes...> && Convertible<Callable<T, ArgTypes...>::result_type, R>
// const T*
// target() const;
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A
() {--count;}
int operator()(int i) const
{
for (int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
int foo(int) const {return 1;}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
{
std::function<int(int)> f = g;
assert(A::count == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
}
assert(A::count == 0);
{
const std::function<int(int)> f = A();
assert(A::count == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
{
const std::function<int(int)> f = g;
assert(A::count == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// template<typename T>
// requires Callable<T, ArgTypes...> && Convertible<Callable<T, ArgTypes...>::result_type, R>
// T*
// target();
// template<typename T>
// requires Callable<T, ArgTypes...> && Convertible<Callable<T, ArgTypes...>::result_type, R>
// const T*
// target() const;
#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A() {--count;}
i
nt operator()(int i) const
{
for (int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
int foo(int) const {return 1;}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
{
std::function<int(int)> f = A();
assert(A::count == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
{
std::function<int(int)> f = g;
assert(A::count == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
}
assert(A::count == 0);
{
const std::function<int(int)> f = A();
assert(A::count == 1);
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
}
assert(A::count == 0);
{
const std::function<int(int)> f = g;
assert(A::count == 0);
assert(f.target<int(*)(int)>());
assert(f.target<A>() == 0);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// const std::type_info& target_type() const;
#include <functional>
#include <typeinfo>
#include <cassert>
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A() {--count;}
int operator()(int i) const
{
for (int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
int foo(int) const {return 1;}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
{
std::function<int(int)>
f = A();
assert(f.target_type() == typeid(A));
}
{
std::function<int(int)> f;
assert(f.target_type() == typeid(void));
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// class function<R(ArgTypes...)>
// const std::type_info& target_type() const;
#include <functional>
#include <typeinfo>
#include <cassert>
class A
{
int data_[10];
public:
static int count;
A()
{
++count;
for (int i = 0; i < 10; ++i)
data_[i] = i;
}
A(const A&) {++count;}
~A() {--count;}
int operator()(int i) const
{
for (int j = 0; j < 10; ++j)
i += data_[j];
return i;
}
int foo(int) const {return 1;}
};
int A::count = 0;
int g(int) {return 0;}
int main()
{
{
std::function<int(int)> f = A();
assert(
f.target_type() == typeid(A));
}
{
std::function<int(int)> f;
assert(f.target_type() == typeid(void));
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, CopyConstructible... ArgTypes>
// class function<R(ArgTypes...)>
// : public unary_function<T1, R> // iff sizeof...(ArgTypes) == 1 and
// // ArgTypes contains T1
// : public binary_function<T1, T2, R> // iff sizeof...(ArgTypes) == 2 and
// // ArgTypes contains T1 and T2
// {
// public:
// typedef R result_type;
// ...
// };
#include <functional>
#include <type_traits>
int main()
{
static_assert((!std::is_base_of<std::unary_function <int, int>,
std::function<int()> >::value), "");
static_assert((!std::is_base_of<std::binary_function<int, int, int>,
std::function<int()> >::value), "");
static_assert(( std::is_same< std::function<int()>::result_type,
int>::value), "");
static_assert(( std::is_base_of<std::unary_function <int, double>,
std::function<double(int)> >::value), "");
static_assert((!std::is_base_of<std::binary_function<int, int, double>,
std::function<double(int)> >::value), "");
static_assert(( std::is_same< std::function<double(int)>::result_type,
double>::value), "");
static_assert((!std::is_base_of<std::unary_function <int, double>,
std::function<double(int, char)> >::value
), "");
static_assert(( std::is_base_of<std::binary_function<int, char, double>,
std::function<double(int, char)> >::value), "");
static_assert(( std::is_same< std::function<double(int, char)>::result_type,
double>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable R, CopyConstructible... ArgTypes>
// class function<R(ArgTypes...)>
// : public unary_function<T1, R> // iff sizeof...(ArgTypes) == 1 and
// // ArgTypes contains T1
// : public binary_function<T1, T2, R> // iff sizeof...(ArgTypes) == 2 and
// // ArgTypes contains T1 and T2
// {
// public:
// typedef R result_type;
// ...
// };
#include <functional>
#include <type_traits>
int main()
{
static_assert((!std::is_base_of<std::unary_function <int, int>,
std::function<
int()> >::value), "");
static_assert((!std::is_base_of<std::binary_function<int, int, int>,
std::function<int()> >::value), "");
static_assert(( std::is_same< std::function<int()>::result_type,
int>::value), "");
static_assert(( std::is_base_of<std::unary_function <int, double>,
std::function<double(int)> >::value), "");
static_assert((!std::is_base_of<std::binary_function<int, int, double>,
std::function<double(int)> >::value), "");
static_assert(( std::is_same< std::function<double(int)>::result_type,
double>::value), "");
static_assert((!std::is_base_of<std::unary_function <int, double>,
std::function<double(int, char)> >::value), "");
static_a
ssert(( std::is_base_of<std::binary_function<int, char, double>,
std::function<double(int, char)> >::value), "");
static_assert(( std::is_same< std::function<double(int, char)>::result_type,
double>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_binary_function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_binary_function.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_binary_function.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_binary_function.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// pointer_to_binary_function
#include <functional>
#include <type_traits>
#include <cassert>
double binary_f(int i, short j) {return i - j + .75;}
int main()
{
typedef std::pointer_to_binary_function<int, short, double> F;
static_assert((std::is_base_of<std::binary_function<int, short, double>, F>::value), "");
const F f(binary_f);
assert(f(36, 27) == 9.75);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// pointer_to_binary_function
#include <functional>
#include <type_traits>
#include <cassert>
double binary_f(int i, short j) {return i - j + .75;}
int main()
{
typedef std::pointer_to_binary_function<int, short, double> F;
static_assert((std::is_base_of<std::binary_function<int, short, double>, F>::value), "");
const F f(binary_f);
assert(f(36, 27) == 9.75);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_unary_function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_unary_function.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_unary_function.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_unary_function.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// pointer_to_unary_function
#include <functional>
#include <type_traits>
#include <cassert>
double unary_f(int i) {return 0.5 - i;}
int main()
{
typedef std::pointer_to_unary_function<int, double> F;
static_assert((std::is_base_of<std::unary_function<int, double>, F>::value), "");
const F f(unary_f);
assert(f(36) == -35.5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// pointer_to_unary_function
#include <functional>
#include <type_traits>
#include <cassert>
double unary_f(int i) {return 0.5 - i;}
int main()
{
typedef std::pointer_to_unary_function<int, double> F;
static_assert((std::is_base_of<std::unary_function<int, double>, F>::value), "");
const F f(unary_f);
assert(f(36) == -35.5);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun1.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun1.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template <CopyConstructible Arg, Returnable Result>
// pointer_to_unary_function<Arg, Result>
// ptr_fun(Result (*f)(Arg));
#include <functional>
#include <type_traits>
#include <cassert>
double unary_f(int i) {return 0.5 - i;}
int main()
{
assert(std::ptr_fun(unary_f)(36) == -35.5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template <CopyConstructible Arg, Returnable Result>
// pointer_to_unary_function<Arg, Result>
// ptr_fun(Result (*f)(Arg));
#include <functional>
#include <type_traits>
#include <cassert>
double unary_f(int i) {return 0.5 - i;}
int main()
{
assert(std::ptr_fun(unary_f)(36) == -35.5);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun2.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun2.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun2.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template <CopyConstructible Arg1, CopyConstructible Arg2, Returnable Result>
// pointer_to_binary_function<Arg1,Arg2,Result>
// ptr_fun(Result (*f)(Arg1, Arg2));
#include <functional>
#include <type_traits>
#include <cassert>
double binary_f(int i, short j) {return i - j + .75;}
int main()
{
assert(std::ptr_fun(binary_f)(36, 27) == 9.75);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template <CopyConstructible Arg1, CopyConstructible Arg2, Returnable Result>
// pointer_to_binary_function<Arg1,Arg2,Result>
// ptr_fun(Result (*f)(Arg1, Arg2));
#include <functional>
#include <type_traits>
#include <cassert>
double binary_f(int i, short j) {return i - j + .75;}
int main()
{
assert(std::ptr_fun(binary_f)(36, 27) == 9.75);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// logical_and
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::logical_and<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(f(36, 36));
assert(!f(36, 0));
assert(!f(0, 36));
assert(!f(0, 0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// logical_and
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::logical_and<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(f(36, 36));
assert(!f(36, 0));
assert(!f(0, 36));
assert(!f(0, 0));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// logical_not
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::logical_not<int> F;
const F f = F();
static_assert((std::is_base_of<std::unary_function<int, bool>, F>::value), "");
assert(!f(36));
assert(f(0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// logical_not
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::logical_not<int> F;
const F f = F();
static_assert((std::is_base_of<std::unary_function<int, bool>, F>::value), "");
assert(!f(36));
assert(f(0));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// logical_or
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::logical_or<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(f(36, 36));
assert(f(36, 0));
assert(f(0, 36));
assert(!f(0, 0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// logical_or
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::logical_or<int> F;
const F f = F();
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(f(36, 36));
assert(f(36, 0));
assert(f(0, 36));
assert(!f(0, 0));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<cReturnable S, ClassType T>
// const_mem_fun_t<S,T>
// mem_fun(S (T::*f)() const);
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
const A a = A();
assert(std::mem_fun(&A::a3)(&a) == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<cReturnable S, ClassType T>
// const_mem_fun_t<S,T>
// mem_fun(S (T::*f)() const);
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
const A a = A();
assert(std::mem_fun(&A::a3)(&a) == 1);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T, CopyConstructible A>
// const_mem_fun1_t<S,T,A>
// mem_fun(S (T::*f)(A) const);
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
const A a = A();
assert(std::mem_fun(&A::a4)(&a, 6) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T, CopyConstructible A>
// const_mem_fun1_t<S,T,A>
// mem_fun(S (T::*f)(A) const);
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
const A a = A();
assert(std::mem_fun(&A::a4)(&a, 6) == 5);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// const_mem_fun1_ref_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::const_mem_fun1_ref_t<double, A, unsigned> F;
static_assert((std::is_base_of<std::binary_function<A, unsigned, double>, F>::value), "");
const F f(&A::a4);
const A a = A();
assert(f(a, 6) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// const_mem_fun1_ref_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::const_mem_fun1_ref_t<double, A, unsigned> F;
static_assert((std::is_base_of<std::binary_function<A, unsigned, double>, F>::value), "");
const F f(&A::a4);
const A a = A();
assert(f(a, 6) == 5);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_t.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_t.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// const_mem_fun1_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::const_mem_fun1_t<double, A, unsigned> F;
static_assert((std::is_base_of<std::binary_function<const A*, unsigned, double>, F>::value), "");
const F f(&A::a4);
const A a = A();
assert(f(&a, 6) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// const_mem_fun1_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::const_mem_fun1_t<double, A, unsigned> F;
static_assert((std::is_base_of<std::binary_function<const A*, unsigned, double>, F>::value), "");
const F f(&A::a4);
const A a = A();
assert(f(&a, 6) == 5);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T>
// const_mem_fun_ref_t<S,T>
// mem_fun_ref(S (T::*f)() const);
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
const A a = A();
assert(std::mem_fun_ref(&A::a3)(a) == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T>
// const_mem_fun_ref_t<S,T>
// mem_fun_ref(S (T::*f)() const);
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
const A a = A();
assert(std::mem_fun_ref(&A::a3)(a) == 1);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref1.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref1.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T, CopyConstructible A>
// const_mem_fun1_ref_t<S,T,A>
// mem_fun_ref(S (T::*f)(A) const);
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
const A a = A();
assert(std::mem_fun_ref(&A::a4)(a, 6) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T, CopyConstructible A>
// const_mem_fun1_ref_t<S,T,A>
// mem_fun_ref(S (T::*f)(A) const);
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
const A a = A();
assert(std::mem_fun_ref(&A::a4)(a, 6) == 5);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// const_mem_fun_ref_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::const_mem_fun_ref_t<int, A> F;
static_assert((std::is_base_of<std::unary_function<A, int>, F>::value), "");
const F f(&A::a3);
const A a = A();
assert(f(a) == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// const_mem_fun_ref_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::const_mem_fun_ref_t<int, A> F;
static_assert((std::is_base_of<std::unary_function<A, int>, F>::value), "");
const F f(&A::a3);
const A a = A();
assert(f(a) == 1);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_t.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_t.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// const_mem_fun_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::const_mem_fun_t<int, A> F;
static_assert((std::is_base_of<std::unary_function<const A*, int>, F>::value), "");
const F f(&A::a3);
const A a = A();
assert(f(&a) == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// const_mem_fun_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::const_mem_fun_t<int, A> F;
static_assert((std::is_base_of<std::unary_function<const A*, int>, F>::value), "");
const F f(&A::a3);
const A a = A();
assert(f(&a) == 1);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T>
// mem_fun_t<S,T>
// mem_fun(S (T::*f)());
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
A a;
assert(std::mem_fun(&A::a1)(&a) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T>
// mem_fun_t<S,T>
// mem_fun(S (T::*f)());
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
A a;
assert(std::mem_fun(&A::a1)(&a) == 5);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T, CopyConstructible A>
// mem_fun1_t<S,T,A>
// mem_fun(S (T::*f)(A));
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
A a;
assert(std::mem_fun(&A::a2)(&a, 5) == 6);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T, CopyConstructible A>
// mem_fun1_t<S,T,A>
// mem_fun(S (T::*f)(A));
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
A a;
assert(std::mem_fun(&A::a2)(&a, 5) == 6);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_ref_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_ref_t.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_ref_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_ref_t.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// mem_fun1_ref_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::mem_fun1_ref_t<short, A, int> F;
static_assert((std::is_base_of<std::binary_function<A, int, short>, F>::value), "");
const F f(&A::a2);
A a;
assert(f(a, 5) == 6);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// mem_fun1_ref_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::mem_fun1_ref_t<short, A, int> F;
static_assert((std::is_base_of<std::binary_function<A, int, short>, F>::value), "");
const F f(&A::a2);
A a;
assert(f(a, 5) == 6);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_t.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_t.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// mem_fun1_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::mem_fun1_t<short, A, int> F;
static_assert((std::is_base_of<std::binary_function<A*, int, short>, F>::value), "");
const F f(&A::a2);
A a;
assert(f(&a, 5) == 6);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// mem_fun1_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::mem_fun1_t<short, A, int> F;
static_assert((std::is_base_of<std::binary_function<A*, int, short>, F>::value), "");
const F f(&A::a2);
A a;
assert(f(&a, 5) == 6);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T>
// mem_fun_ref_t<S,T>
// mem_fun_ref(S (T::*f)());
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
A a;
assert(std::mem_fun_ref(&A::a1)(a) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T>
// mem_fun_ref_t<S,T>
// mem_fun_ref(S (T::*f)());
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
A a;
assert(std::mem_fun_ref(&A::a1)(a) == 5);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref1.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref1.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T, CopyConstructible A>
// mem_fun1_ref_t<S,T,A>
// mem_fun_ref(S (T::*f)(A));
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
A a;
assert(std::mem_fun_ref(&A::a2)(a, 5) == 6);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// template<Returnable S, ClassType T, CopyConstructible A>
// mem_fun1_ref_t<S,T,A>
// mem_fun_ref(S (T::*f)(A));
#include <functional>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
A a;
assert(std::mem_fun_ref(&A::a2)(a, 5) == 6);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref_t.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref_t.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// mem_fun_ref_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::mem_fun_ref_t<char, A> F;
static_assert((std::is_base_of<std::unary_function<A, char>, F>::value), "");
const F f(&A::a1);
A a;
assert(f(a) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// mem_fun_ref_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::mem_fun_ref_t<char, A> F;
static_assert((std::is_base_of<std::unary_function<A, char>, F>::value), "");
const F f(&A::a1);
A a;
assert(f(a) == 5);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_t.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_t.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// mem_fun_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::mem_fun_t<char, A> F;
static_assert((std::is_base_of<std::unary_function<A*, char>, F>::value), "");
const F f(&A::a1);
A a;
assert(f(&a) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// mem_fun_t
#include <functional>
#include <type_traits>
#include <cassert>
struct A
{
char a1() {return 5;}
short a2(int i) {return short(i+1);}
int a3() const {return 1;}
double a4(unsigned i) const {return i-1;}
};
int main()
{
typedef std::mem_fun_t<char, A> F;
static_assert((std::is_base_of<std::unary_function<A*, char>, F>::value), "");
const F f(&A::a1);
A a;
assert(f(&a) == 5);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/negators/binary_negate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/negators/binary_negate.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/negators/binary_negate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/negators/binary_negate.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// binary_negate
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::binary_negate<std::logical_and<int> > F;
const F f = F(std::logical_and<int>());
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(!f(36, 36));
assert( f(36, 0));
assert( f(0, 36));
assert( f(0, 0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// binary_negate
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::binary_negate<std::logical_and<int> > F;
const F f = F(std::logical_and<int>());
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
assert(!f(36, 36));
assert( f(36, 0));
assert( f(0, 36));
assert( f(0, 0));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/negators/not1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/negators/not1.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/negators/not1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/negators/not1.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// not1
#include <functional>
#include <cassert>
int main()
{
typedef std::logical_not<int> F;
assert(std::not1(F())(36));
assert(!std::not1(F())(0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// not1
#include <functional>
#include <cassert>
int main()
{
typedef std::logical_not<int> F;
assert(std::not1(F())(36));
assert(!std::not1(F())(0));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/negators/not2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/negators/not2.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/negators/not2.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/negators/not2.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// not2
#include <functional>
#include <cassert>
int main()
{
typedef std::logical_and<int> F;
assert(!std::not2(F())(36, 36));
assert( std::not2(F())(36, 0));
assert( std::not2(F())(0, 36));
assert( std::not2(F())(0, 0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// not2
#include <functional>
#include <cassert>
int main()
{
typedef std::logical_and<int> F;
assert(!std::not2(F())(36, 36));
assert( std::not2(F())(36, 0));
assert( std::not2(F())(0, 36));
assert( std::not2(F())(0, 0));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/negators/unary_negate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/negators/unary_negate.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/negators/unary_negate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/negators/unary_negate.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// unary_negate
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::unary_negate<std::logical_not<int> > F;
const F f = F(std::logical_not<int>());
static_assert((std::is_base_of<std::unary_function<int, bool>, F>::value), "");
assert(f(36));
assert(!f(0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// unary_negate
#include <functional>
#include <type_traits>
#include <cassert>
int main()
{
typedef std::unary_negate<std::logical_not<int> > F;
const F f = F(std::logical_not<int>());
static_assert((std::is_base_of<std::unary_function<int, bool>, F>::value), "");
assert(f(36));
assert(!f(0));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/binary.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/binary.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/binary.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/binary.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// check for deriving from binary_function
#include <functional>
#include <type_traits>
class functor1
: public std::unary_function<int, char>
{
};
class functor2
: public std::binary_function<char, int, double>
{
};
class functor3
: public std::unary_function<int, int>,
public std::binary_function<char, int, double>
{
public:
typedef float result_type;
};
class functor4
: public std::unary_function<int, int>,
public std::binary_function<char, int, double>
{
public:
};
struct C
{
typedef int argument_type;
typedef int result_type;
};
i
nt main()
{
static_assert((!std::is_base_of<std::binary_function<int, char, int>,
std::reference_wrapper<functor1> >::value), "");
static_assert((std::is_base_of<std::binary_function<char, int, double>,
std::reference_wrapper<functor2> >::value), "");
static_assert((std::is_base_of<std::binary_function<char, int, double>,
std::reference_wrapper<functor3> >::value), "");
static_assert((std::is_base_of<std::binary_function<char, int, double>,
std::reference_wrapper<functor4> >::value), "");
static_assert((!std::is_base_of<std::binary_function<int, int, int>,
std::reference_wrapper<C> >::value), "");
static_assert((!std::is_base_of<std::binary_function<int, int, float>,
std::reference_wrapper<float ()> >::value), "");
static_assert((!std::is
_base_of<std::binary_function<int, int, float>,
std::reference_wrapper<float (int)> >::value), "");
static_assert((std::is_base_of<std::binary_function<int, int, float>,
std::reference_wrapper<float (int, int)> >::value), "");
static_assert((!std::is_base_of<std::binary_function<int, int, float>,
std::reference_wrapper<float(*)()> >::value), "");
static_assert((!std::is_base_of<std::binary_function<int, int, float>,
std::reference_wrapper<float(*)(int)> >::value), "");
static_assert((std::is_base_of<std::binary_function<int, int, float>,
std::reference_wrapper<float(*)(int, int)> >::value), "");
static_assert((!std::is_base_of<std::binary_function<C*, int, float>,
std::reference_wrapper<float(C::*)()> >::value), "");
static_assert((std::is_ba
se_of<std::binary_function<C*, int, float>,
std::reference_wrapper<float(C::*)(int)> >::value), "");
static_assert((std::is_base_of<std::binary_function<const volatile C*, int, float>,
std::reference_wrapper<float(C::*)(int) const volatile> >::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// check for deriving from binary_function
#include <functional>
#include <type_traits>
class functor1
: public std::unary_function<int, char>
{
};
class functor2
: public std::binary_function<char, int, double>
{
};
class functor3
: public std::unary_function<int, int>,
public std::binary_function<char, int, double>
{
public:
typedef float result_type;
};
class functor4
: public std::unary_function<int, int>,
public std::binary_function<char, int, double>
{
public:
};
struct C
{
typedef int argument_type;
typedef int result_type;
};
int main()
{
stat
ic_assert((!std::is_base_of<std::binary_function<int, char, int>,
std::reference_wrapper<functor1> >::value), "");
static_assert((std::is_base_of<std::binary_function<char, int, double>,
std::reference_wrapper<functor2> >::value), "");
static_assert((std::is_base_of<std::binary_function<char, int, double>,
std::reference_wrapper<functor3> >::value), "");
static_assert((std::is_base_of<std::binary_function<char, int, double>,
std::reference_wrapper<functor4> >::value), "");
static_assert((!std::is_base_of<std::binary_function<int, int, int>,
std::reference_wrapper<C> >::value), "");
static_assert((!std::is_base_of<std::binary_function<int, int, float>,
std::reference_wrapper<float ()> >::value), "");
static_assert((!std::is_base_of<std::binary
_function<int, int, float>,
std::reference_wrapper<float (int)> >::value), "");
static_assert((std::is_base_of<std::binary_function<int, int, float>,
std::reference_wrapper<float (int, int)> >::value), "");
static_assert((!std::is_base_of<std::binary_function<int, int, float>,
std::reference_wrapper<float(*)()> >::value), "");
static_assert((!std::is_base_of<std::binary_function<int, int, float>,
std::reference_wrapper<float(*)(int)> >::value), "");
static_assert((std::is_base_of<std::binary_function<int, int, float>,
std::reference_wrapper<float(*)(int, int)> >::value), "");
static_assert((!std::is_base_of<std::binary_function<C*, int, float>,
std::reference_wrapper<float(C::*)()> >::value), "");
static_assert((std::is_base_of<std::binary_fu
nction<C*, int, float>,
std::reference_wrapper<float(C::*)(int)> >::value), "");
static_assert((std::is_base_of<std::binary_function<const volatile C*, int, float>,
std::reference_wrapper<float(C::*)(int) const volatile> >::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// operator T& () const;
#include <functional>
#include <cassert>
class functor1
: public std::unary_function<int, char>
{
};
template <class T>
void
test(T& t)
{
std::reference_wrapper<T> r(t);
T& r2 = r;
assert(&r2 == &t);
}
void f() {}
int main()
{
void (*fp)() = f;
test(fp);
test(f);
functor1 f1;
test(f1);
int i = 0;
test(i);
const int j = 0;
test(j);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// operator T& () const;
#include <functional>
#include <cassert>
class functor1
: public std::unary_function<int, char>
{
};
template <class T>
void
test(T& t)
{
std::reference_wrapper<T> r(t);
T& r2 = r;
assert(&r2 == &t);
}
void f() {}
int main()
{
void (*fp)() = f;
test(fp);
test(f);
functor1 f1;
test(f1);
int i = 0;
test(i);
const int j = 0;
test(j);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// reference_wrapper& operator=(const reference_wrapper<T>& x);
#include <functional>
#include <cassert>
class functor1
: public std::unary_function<int, char>
{
};
template <class T>
void
test(T& t)
{
std::reference_wrapper<T> r(t);
T t2 = t;
std::reference_wrapper<T> r2(t2);
r2 = r;
assert(&r2.get() == &t);
}
void f() {}
void g() {}
void
test_function()
{
std::reference_wrapper<void ()> r(f);
std::reference_wrapper<void ()> r2(g);
r2 = r;
assert(&r2.get() == &f);
}
int main()
{
void (*fp)() = f;
test(fp);
test_function();
functor1 f1;
test(f1);
int i = 0;
test(i);
const int j = 0;
test(j);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// reference_wrapper& operator=(const reference_wrapper<T>& x);
#include <functional>
#include <cassert>
class functor1
: public std::unary_function<int, char>
{
};
template <class T>
void
test(T& t)
{
std::reference_wrapper<T> r(t);
T t2 = t;
std::reference_wrapper<T> r2(t2);
r2 = r;
assert(&r2.get() == &t);
}
void f() {}
void g() {}
void
test_function()
{
std::reference_wrapper<void ()> r(f);
std::reference_wrapper<void ()> r2(g);
r2 = r;
assert(&r2.get() == &f);
}
int main()
{
void (*fp)() = f;
test(fp);
test_function();
functor1 f1;
test(f1);
int i = 0;
test(i);
const int j = 0;
test(j);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// reference_wrapper(const reference_wrapper<T>& x);
#include <functional>
#include <cassert>
class functor1
: public std::unary_function<int, char>
{
};
template <class T>
void
test(T& t)
{
std::reference_wrapper<T> r(t);
std::reference_wrapper<T> r2 = r;
assert(&r2.get() == &t);
}
void f() {}
int main()
{
void (*fp)() = f;
test(fp);
test(f);
functor1 f1;
test(f1);
int i = 0;
test(i);
const int j = 0;
test(j);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// reference_wrapper(const reference_wrapper<T>& x);
#include <functional>
#include <cassert>
class functor1
: public std::unary_function<int, char>
{
};
template <class T>
void
test(T& t)
{
std::reference_wrapper<T> r(t);
std::reference_wrapper<T> r2 = r;
assert(&r2.get() == &t);
}
void f() {}
int main()
{
void (*fp)() = f;
test(fp);
test(f);
functor1 f1;
test(f1);
int i = 0;
test(i);
const int j = 0;
test(j);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// reference_wrapper(T&&) = delete;
#include <functional>
#include <cassert>
int main()
{
std::reference_wrapper<const int> r(3);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// reference_wrapper(T&&) = delete;
#include <functional>
#include <cassert>
int main()
{
std::reference_wrapper<const int> r(3);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// reference_wrapper(T& t);
#include <functional>
#include <cassert>
class functor1
: public std::unary_function<int, char>
{
};
template <class T>
void
test(T& t)
{
std::reference_wrapper<T> r(t);
assert(&r.get() == &t);
}
void f() {}
int main()
{
void (*fp)() = f;
test(fp);
test(f);
functor1 f1;
test(f1);
int i = 0;
test(i);
const int j = 0;
test(j);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// reference_wrapper(T& t);
#include <functional>
#include <cassert>
class functor1
: public std::unary_function<int, char>
{
};
template <class T>
void
test(T& t)
{
std::reference_wrapper<T> r(t);
assert(&r.get() == &t);
}
void f() {}
int main()
{
void (*fp)() = f;
test(fp);
test(f);
functor1 f1;
test(f1);
int i = 0;
test(i);
const int j = 0;
test(j);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_1.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_1.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <ObjectType T> reference_wrapper<const T> cref(const T& t);
#include <functional>
#include <cassert>
int main()
{
int i = 0;
std::reference_wrapper<const int> r = std::cref(i);
assert(&r.get() == &i);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <ObjectType T> reference_wrapper<const T> cref(const T& t);
#include <functional>
#include <cassert>
int main()
{
int i = 0;
std::reference_wrapper<const int> r = std::cref(i);
assert(&r.get() == &i);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_2.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_2.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_2.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <ObjectType T> reference_wrapper<const T> cref(reference_wrapper<T> t);
#include <functional>
#include <cassert>
int main()
{
const int i = 0;
std::reference_wrapper<const int> r1 = std::cref(i);
std::reference_wrapper<const int> r2 = std::cref(r1);
assert(&r2.get() == &i);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <ObjectType T> reference_wrapper<const T> cref(reference_wrapper<T> t);
#include <functional>
#include <cassert>
int main()
{
const int i = 0;
std::reference_wrapper<const int> r1 = std::cref(i);
std::reference_wrapper<const int> r2 = std::cref(r1);
assert(&r2.get() == &i);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <ObjectType T> reference_wrapper<T> ref(T& t);
// Don't allow binding to a temp
#include <functional>
struct A {};
const A source() {return A();}
int main()
{
std::reference_wrapper<const A> r = std::ref(source());
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <ObjectType T> reference_wrapper<T> ref(T& t);
// Don't allow binding to a temp
#include <functional>
struct A {};
const A source() {return A();}
int main()
{
std::reference_wrapper<const A> r = std::ref(source());
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <ObjectType T> reference_wrapper<T> ref(T& t);
#include <functional>
#include <cassert>
int main()
{
int i = 0;
std::reference_wrapper<int> r = std::ref(i);
assert(&r.get() == &i);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <ObjectType T> reference_wrapper<T> ref(T& t);
#include <functional>
#include <cassert>
int main()
{
int i = 0;
std::reference_wrapper<int> r = std::ref(i);
assert(&r.get() == &i);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <ObjectType T> reference_wrapper<T> ref(reference_wrapper<T>t);
#include <functional>
#include <cassert>
int main()
{
int i = 0;
std::reference_wrapper<int> r1 = std::ref(i);
std::reference_wrapper<int> r2 = std::ref(r1);
assert(&r2.get() == &i);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <ObjectType T> reference_wrapper<T> ref(reference_wrapper<T>t);
#include <functional>
#include <cassert>
int main()
{
int i = 0;
std::reference_wrapper<int> r1 = std::ref(i);
std::reference_wrapper<int> r2 = std::ref(r1);
assert(&r2.get() == &i);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.fail.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <class... ArgTypes>
// requires Callable<T, ArgTypes&&...>
// Callable<T, ArgTypes&&...>::result_type
// operator()(ArgTypes&&... args) const;
#include <functional>
#include <cassert>
// member data pointer: cv qualifiers should transfer from argument to return type
struct A_int_1
{
A_int_1() : data_(5) {}
int data_;
};
void
test_int_1()
{
// member data pointer
{
int A_int_1::*fp = &A_int_1::data_;
std::reference_wrapper<int A_int_1::*> r1(fp);
A_int_1 a;
assert(r1(a) == 5);
r1(a) = 6;
assert(r1(a) == 6);
const
A_int_1* ap = &a;
assert(r1(ap) == 6);
r1(ap) = 7;
assert(r1(ap) == 7);
}
}
int main()
{
test_int_1();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <class... ArgTypes>
// requires Callable<T, ArgTypes&&...>
// Callable<T, ArgTypes&&...>::result_type
// operator()(ArgTypes&&... args) const;
#include <functional>
#include <cassert>
// member data pointer: cv qualifiers should transfer from argument to return type
struct A_int_1
{
A_int_1() : data_(5) {}
int data_;
};
void
test_int_1()
{
// member data pointer
{
int A_int_1::*fp = &A_int_1::data_;
std::reference_wrapper<int A_int_1::*> r1(fp);
A_int_1 a;
assert(r1(a) == 5);
r1(a) = 6;
assert(r1(a) == 6);
const A_int_1* ap = &a;
assert(r1(ap) == 6);
r1(ap) = 7;
assert(r1(ap) == 7);
}
}
int main()
{
test_int_1();
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <class... ArgTypes>
// requires Callable<T, ArgTypes&&...>
// Callable<T, ArgTypes&&...>::result_type
// operator()(ArgTypes&&... args) const;
#include <functional>
#include <cassert>
int count = 0;
// 1 arg, return void
void f_void_1(int i)
{
count += i;
}
struct A_void_1
{
void operator()(int i)
{
count += i;
}
void mem1() {++count;}
void mem2() const {++count;}
};
void
test_void_1()
{
int save_count = count;
// function
{
std::reference_wrapper<void (int)> r1(f_void_1);
int i = 2;
r1(i);
asse
rt(count == save_count+2);
save_count = count;
}
// function pointer
{
void (*fp)(int) = f_void_1;
std::reference_wrapper<void (*)(int)> r1(fp);
int i = 3;
r1(i);
assert(count == save_count+3);
save_count = count;
}
// functor
{
A_void_1 a0;
std::reference_wrapper<A_void_1> r1(a0);
int i = 4;
r1(i);
assert(count == save_count+4);
save_count = count;
}
// member function pointer
{
void (A_void_1::*fp)() = &A_void_1::mem1;
std::reference_wrapper<void (A_void_1::*)()> r1(fp);
A_void_1 a;
r1(a);
assert(count == save_count+1);
save_count = count;
A_void_1* ap = &a;
r1(ap);
assert(count == save_count+1);
save_count = count;
}
// const member function pointer
{
void (A_void_1::*fp)() const = &A_void_1::mem2;
std::reference_wrapper<void (A_void_1::*)() const> r1(fp);
A_void_1 a;
r1(a);
assert(count == save_count+1);
save_
count = count;
A_void_1* ap = &a;
r1(ap);
assert(count == save_count+1);
save_count = count;
}
}
// 1 arg, return int
int f_int_1(int i)
{
return i + 1;
}
struct A_int_1
{
A_int_1() : data_(5) {}
int operator()(int i)
{
return i - 1;
}
int mem1() {return 3;}
int mem2() const {return 4;}
int data_;
};
void
test_int_1()
{
// function
{
std::reference_wrapper<int (int)> r1(f_int_1);
int i = 2;
assert(r1(i) == 3);
}
// function pointer
{
int (*fp)(int) = f_int_1;
std::reference_wrapper<int (*)(int)> r1(fp);
int i = 3;
assert(r1(i) == 4);
}
// functor
{
A_int_1 a0;
std::reference_wrapper<A_int_1> r1(a0);
int i = 4;
assert(r1(i) == 3);
}
// member function pointer
{
int (A_int_1::*fp)() = &A_int_1::mem1;
std::reference_wrapper<int (A_int_1::*)()> r1(fp);
A_int_1 a;
assert(r1(a) == 3);
A_int_1* ap = &a;
asse
rt(r1(ap) == 3);
}
// const member function pointer
{
int (A_int_1::*fp)() const = &A_int_1::mem2;
std::reference_wrapper<int (A_int_1::*)() const> r1(fp);
A_int_1 a;
assert(r1(a) == 4);
A_int_1* ap = &a;
assert(r1(ap) == 4);
}
// member data pointer
{
int A_int_1::*fp = &A_int_1::data_;
std::reference_wrapper<int A_int_1::*> r1(fp);
A_int_1 a;
assert(r1(a) == 5);
r1(a) = 6;
assert(r1(a) == 6);
A_int_1* ap = &a;
assert(r1(ap) == 6);
r1(ap) = 7;
assert(r1(ap) == 7);
}
}
// 2 arg, return void
void f_void_2(int i, int j)
{
count += i+j;
}
struct A_void_2
{
void operator()(int i, int j)
{
count += i+j;
}
void mem1(int i) {count += i;}
void mem2(int i) const {count += i;}
};
void
test_void_2()
{
int save_count = count;
// function
{
std::reference_wrapper<void (int, int)> r1(f_void_2);
int i = 2;
int j = 3;
r1(i, j);
asse
rt(count == save_count+5);
save_count = count;
}
// function pointer
{
void (*fp)(int, int) = f_void_2;
std::reference_wrapper<void (*)(int, int)> r1(fp);
int i = 3;
int j = 4;
r1(i, j);
assert(count == save_count+7);
save_count = count;
}
// functor
{
A_void_2 a0;
std::reference_wrapper<A_void_2> r1(a0);
int i = 4;
int j = 5;
r1(i, j);
assert(count == save_count+9);
save_count = count;
}
// member function pointer
{
void (A_void_2::*fp)(int) = &A_void_2::mem1;
std::reference_wrapper<void (A_void_2::*)(int)> r1(fp);
A_void_2 a;
int i = 3;
r1(a, i);
assert(count == save_count+3);
save_count = count;
A_void_2* ap = &a;
r1(ap, i);
assert(count == save_count+3);
save_count = count;
}
// const member function pointer
{
void (A_void_2::*fp)(int) const = &A_void_2::mem2;
std::reference_wrapper<void (A_void_2::*)(int) const>
r1(fp);
A_void_2 a;
int i = 4;
r1(a, i);
assert(count == save_count+4);
save_count = count;
A_void_2* ap = &a;
r1(ap, i);
assert(count == save_count+4);
save_count = count;
}
}
// 2 arg, return int
int f_int_2(int i, int j)
{
return i+j;
}
struct A_int_2
{
int operator()(int i, int j)
{
return i+j;
}
int mem1(int i) {return i+1;}
int mem2(int i) const {return i+2;}
};
void
testint_2()
{
// function
{
std::reference_wrapper<int (int, int)> r1(f_int_2);
int i = 2;
int j = 3;
assert(r1(i, j) == i+j);
}
// function pointer
{
int (*fp)(int, int) = f_int_2;
std::reference_wrapper<int (*)(int, int)> r1(fp);
int i = 3;
int j = 4;
assert(r1(i, j) == i+j);
}
// functor
{
A_int_2 a0;
std::reference_wrapper<A_int_2> r1(a0);
int i = 4;
int j = 5;
assert(r1(i, j) == i+j);
}
// member function pointer
{
int(A_in
t_2::*fp)(int) = &A_int_2::mem1;
std::reference_wrapper<int (A_int_2::*)(int)> r1(fp);
A_int_2 a;
int i = 3;
assert(r1(a, i) == i+1);
A_int_2* ap = &a;
assert(r1(ap, i) == i+1);
}
// const member function pointer
{
int (A_int_2::*fp)(int) const = &A_int_2::mem2;
std::reference_wrapper<int (A_int_2::*)(int) const> r1(fp);
A_int_2 a;
int i = 4;
assert(r1(a, i) == i+2);
A_int_2* ap = &a;
assert(r1(ap, i) == i+2);
}
}
int main()
{
test_void_1();
test_int_1();
test_void_2();
testint_2();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <class... ArgTypes>
// requires Callable<T, ArgTypes&&...>
// Callable<T, ArgTypes&&...>::result_type
// operator()(ArgTypes&&... args) const;
#include <functional>
#include <cassert>
int count = 0;
// 1 arg, return void
void f_void_1(int i)
{
count += i;
}
struct A_void_1
{
void operator()(int i)
{
count += i;
}
void mem1() {++count;}
void mem2() const {++count;}
};
void
test_void_1()
{
int save_count = count;
// function
{
std::reference_wrapper<void (int)> r1(f_void_1);
int i = 2;
r1(i);
assert(count == save_cou
nt+2);
save_count = count;
}
// function pointer
{
void (*fp)(int) = f_void_1;
std::reference_wrapper<void (*)(int)> r1(fp);
int i = 3;
r1(i);
assert(count == save_count+3);
save_count = count;
}
// functor
{
A_void_1 a0;
std::reference_wrapper<A_void_1> r1(a0);
int i = 4;
r1(i);
assert(count == save_count+4);
save_count = count;
}
// member function pointer
{
void (A_void_1::*fp)() = &A_void_1::mem1;
std::reference_wrapper<void (A_void_1::*)()> r1(fp);
A_void_1 a;
r1(a);
assert(count == save_count+1);
save_count = count;
A_void_1* ap = &a;
r1(ap);
assert(count == save_count+1);
save_count = count;
}
// const member function pointer
{
void (A_void_1::*fp)() const = &A_void_1::mem2;
std::reference_wrapper<void (A_void_1::*)() const> r1(fp);
A_void_1 a;
r1(a);
assert(count == save_count+1);
save_count = count;
A
_void_1* ap = &a;
r1(ap);
assert(count == save_count+1);
save_count = count;
}
}
// 1 arg, return int
int f_int_1(int i)
{
return i + 1;
}
struct A_int_1
{
A_int_1() : data_(5) {}
int operator()(int i)
{
return i - 1;
}
int mem1() {return 3;}
int mem2() const {return 4;}
int data_;
};
void
test_int_1()
{
// function
{
std::reference_wrapper<int (int)> r1(f_int_1);
int i = 2;
assert(r1(i) == 3);
}
// function pointer
{
int (*fp)(int) = f_int_1;
std::reference_wrapper<int (*)(int)> r1(fp);
int i = 3;
assert(r1(i) == 4);
}
// functor
{
A_int_1 a0;
std::reference_wrapper<A_int_1> r1(a0);
int i = 4;
assert(r1(i) == 3);
}
// member function pointer
{
int (A_int_1::*fp)() = &A_int_1::mem1;
std::reference_wrapper<int (A_int_1::*)()> r1(fp);
A_int_1 a;
assert(r1(a) == 3);
A_int_1* ap = &a;
assert(r1(ap) == 3);
}
// const member function pointer
{
int (A_int_1::*fp)() const = &A_int_1::mem2;
std::reference_wrapper<int (A_int_1::*)() const> r1(fp);
A_int_1 a;
assert(r1(a) == 4);
A_int_1* ap = &a;
assert(r1(ap) == 4);
}
// member data pointer
{
int A_int_1::*fp = &A_int_1::data_;
std::reference_wrapper<int A_int_1::*> r1(fp);
A_int_1 a;
assert(r1(a) == 5);
r1(a) = 6;
assert(r1(a) == 6);
A_int_1* ap = &a;
assert(r1(ap) == 6);
r1(ap) = 7;
assert(r1(ap) == 7);
}
}
// 2 arg, return void
void f_void_2(int i, int j)
{
count += i+j;
}
struct A_void_2
{
void operator()(int i, int j)
{
count += i+j;
}
void mem1(int i) {count += i;}
void mem2(int i) const {count += i;}
};
void
test_void_2()
{
int save_count = count;
// function
{
std::reference_wrapper<void (int, int)> r1(f_void_2);
int i = 2;
int j = 3;
r1(i, j);
assert(count == save_cou
nt+5);
save_count = count;
}
// function pointer
{
void (*fp)(int, int) = f_void_2;
std::reference_wrapper<void (*)(int, int)> r1(fp);
int i = 3;
int j = 4;
r1(i, j);
assert(count == save_count+7);
save_count = count;
}
// functor
{
A_void_2 a0;
std::reference_wrapper<A_void_2> r1(a0);
int i = 4;
int j = 5;
r1(i, j);
assert(count == save_count+9);
save_count = count;
}
// member function pointer
{
void (A_void_2::*fp)(int) = &A_void_2::mem1;
std::reference_wrapper<void (A_void_2::*)(int)> r1(fp);
A_void_2 a;
int i = 3;
r1(a, i);
assert(count == save_count+3);
save_count = count;
A_void_2* ap = &a;
r1(ap, i);
assert(count == save_count+3);
save_count = count;
}
// const member function pointer
{
void (A_void_2::*fp)(int) const = &A_void_2::mem2;
std::reference_wrapper<void (A_void_2::*)(int) const> r1(fp);
A_void_2
a;
int i = 4;
r1(a, i);
assert(count == save_count+4);
save_count = count;
A_void_2* ap = &a;
r1(ap, i);
assert(count == save_count+4);
save_count = count;
}
}
// 2 arg, return int
int f_int_2(int i, int j)
{
return i+j;
}
struct A_int_2
{
int operator()(int i, int j)
{
return i+j;
}
int mem1(int i) {return i+1;}
int mem2(int i) const {return i+2;}
};
void
testint_2()
{
// function
{
std::reference_wrapper<int (int, int)> r1(f_int_2);
int i = 2;
int j = 3;
assert(r1(i, j) == i+j);
}
// function pointer
{
int (*fp)(int, int) = f_int_2;
std::reference_wrapper<int (*)(int, int)> r1(fp);
int i = 3;
int j = 4;
assert(r1(i, j) == i+j);
}
// functor
{
A_int_2 a0;
std::reference_wrapper<A_int_2> r1(a0);
int i = 4;
int j = 5;
assert(r1(i, j) == i+j);
}
// member function pointer
{
int(A_int_2::*fp)(int) = &A_
int_2::mem1;
std::reference_wrapper<int (A_int_2::*)(int)> r1(fp);
A_int_2 a;
int i = 3;
assert(r1(a, i) == i+1);
A_int_2* ap = &a;
assert(r1(ap, i) == i+1);
}
// const member function pointer
{
int (A_int_2::*fp)(int) const = &A_int_2::mem2;
std::reference_wrapper<int (A_int_2::*)(int) const> r1(fp);
A_int_2 a;
int i = 4;
assert(r1(a, i) == i+2);
A_int_2* ap = &a;
assert(r1(ap, i) == i+2);
}
}
int main()
{
test_void_1();
test_int_1();
test_void_2();
testint_2();
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_int_0.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_int_0.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_int_0.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_int_0.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <class... ArgTypes>
// requires Callable<T, ArgTypes&&...>
// Callable<T, ArgTypes&&...>::result_type
// operator()(ArgTypes&&... args) const;
#include <functional>
#include <cassert>
// 0 args, return int
int count = 0;
int f_int_0()
{
return 3;
}
struct A_int_0
{
int operator()() {return 4;}
};
void
test_int_0()
{
// function
{
std::reference_wrapper<int ()> r1(f_int_0);
assert(r1() == 3);
}
// function pointer
{
int (*fp)() = f_int_0;
std::reference_wrapper<int (*)()> r1(fp);
assert(r1() == 3);
}
// functor
{
A_int_0 a0;
std::reference_wrapper<A_int_0> r1(a0);
assert(r1() == 4);
}
}
// 1 arg, return void
void f_void_1(int i)
{
count += i;
}
struct A_void_1
{
void operator()(int i)
{
count += i;
}
};
int main()
{
test_int_0();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <class... ArgTypes>
// requires Callable<T, ArgTypes&&...>
// Callable<T, ArgTypes&&...>::result_type
// operator()(ArgTypes&&... args) const;
#include <functional>
#include <cassert>
// 0 args, return int
int count = 0;
int f_int_0()
{
return 3;
}
struct A_int_0
{
int operator()() {return 4;}
};
void
test_int_0()
{
// function
{
std::reference_wrapper<int ()> r1(f_int_0);
assert(r1() == 3);
}
// function pointer
{
int (*fp)() = f_int_0;
std::reference_wrapper<int (*)()> r1(fp);
assert(r1() == 3);
}
// functor
{
A_int_0 a0;
std::reference_wrapper<A_int_0> r1(a0);
assert(r1() == 4);
}
}
// 1 arg, return void
void f_void_1(int i)
{
count += i;
}
struct A_void_1
{
void operator()(int i)
{
count += i;
}
};
int main()
{
test_int_0();
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_void_0.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_void_0.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_void_0.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_void_0.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <class... ArgTypes>
// requires Callable<T, ArgTypes&&...>
// Callable<T, ArgTypes&&...>::result_type
// operator()(ArgTypes&&... args) const;
#include <functional>
#include <cassert>
// 0 args, return void
int count = 0;
void f_void_0()
{
++count;
}
struct A_void_0
{
void operator()() {++count;}
};
void
test_void_0()
{
int save_count = count;
// function
{
std::reference_wrapper<void ()> r1(f_void_0);
r1();
assert(count == save_count+1);
save_count = count;
}
// function pointer
{
void (*fp)() = f_void_
0;
std::reference_wrapper<void (*)()> r1(fp);
r1();
assert(count == save_count+1);
save_count = count;
}
// functor
{
A_void_0 a0;
std::reference_wrapper<A_void_0> r1(a0);
r1();
assert(count == save_count+1);
save_count = count;
}
}
int main()
{
test_void_0();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// template <class... ArgTypes>
// requires Callable<T, ArgTypes&&...>
// Callable<T, ArgTypes&&...>::result_type
// operator()(ArgTypes&&... args) const;
#include <functional>
#include <cassert>
// 0 args, return void
int count = 0;
void f_void_0()
{
++count;
}
struct A_void_0
{
void operator()() {++count;}
};
void
test_void_0()
{
int save_count = count;
// function
{
std::reference_wrapper<void ()> r1(f_void_0);
r1();
assert(count == save_count+1);
save_count = count;
}
// function pointer
{
void (*fp)() = f_void_0;
std::referenc
e_wrapper<void (*)()> r1(fp);
r1();
assert(count == save_count+1);
save_count = count;
}
// functor
{
A_void_0 a0;
std::reference_wrapper<A_void_0> r1(a0);
r1();
assert(count == save_count+1);
save_count = count;
}
}
int main()
{
test_void_0();
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/type.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/type.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// check for member typedef type
#include <functional>
#include <type_traits>
class C {};
int main()
{
static_assert((std::is_same<std::reference_wrapper<C>::type,
C>::value), "");
static_assert((std::is_same<std::reference_wrapper<void ()>::type,
void ()>::value), "");
static_assert((std::is_same<std::reference_wrapper<int* (double*)>::type,
int* (double*)>::value), "");
static_assert((std::is_same<s
td::reference_wrapper<void(*)()>::type,
void(*)()>::value), "");
static_assert((std::is_same<std::reference_wrapper<int*(*)(double*)>::type,
int*(*)(double*)>::value), "");
static_assert((std::is_same<std::reference_wrapper<int*(C::*)(double*)>::type,
int*(C::*)(double*)>::value), "");
static_assert((std::is_same<std::reference_wrapper<int (C::*)(double*) const volatile>::type,
int (C::*)(double*) const volatile>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// check for member typedef type
#include <functional>
#include <type_traits>
class C {};
int main()
{
static_assert((std::is_same<std::reference_wrapper<C>::type,
C>::value), "");
static_assert((std::is_same<std::reference_wrapper<void ()>::type,
void ()>::value), "");
static_assert((std::is_same<std::reference_wrapper<int* (double*)>::type,
int* (double*)>::value), "");
static_assert((std::is_same<std::reference_wrappe
r<void(*)()>::type,
void(*)()>::value), "");
static_assert((std::is_same<std::reference_wrapper<int*(*)(double*)>::type,
int*(*)(double*)>::value), "");
static_assert((std::is_same<std::reference_wrapper<int*(C::*)(double*)>::type,
int*(C::*)(double*)>::value), "");
static_assert((std::is_same<std::reference_wrapper<int (C::*)(double*) const volatile>::type,
int (C::*)(double*) const volatile>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/unary.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/unary.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/unary.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/unary.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// check for deriving from unary_function
#include <functional>
#include <type_traits>
class functor1
: public std::unary_function<int, char>
{
};
class functor2
: public std::binary_function<char, int, double>
{
};
class functor3
: public std::unary_function<int, int>,
public std::binary_function<char, int, double>
{
public:
typedef float result_type;
};
class functor4
: public std::unary_function<int, int>,
public std::binary_function<char, int, double>
{
public:
};
struct C
{
typedef int argument_type;
typedef int result_type;
};
in
t main()
{
static_assert((std::is_base_of<std::unary_function<int, char>,
std::reference_wrapper<functor1> >::value), "");
static_assert((!std::is_base_of<std::unary_function<char, int>,
std::reference_wrapper<functor2> >::value), "");
static_assert((std::is_base_of<std::unary_function<int, int>,
std::reference_wrapper<functor3> >::value), "");
static_assert((std::is_base_of<std::unary_function<int, int>,
std::reference_wrapper<functor4> >::value), "");
static_assert((!std::is_base_of<std::unary_function<int, int>,
std::reference_wrapper<C> >::value), "");
static_assert((!std::is_base_of<std::unary_function<int, float>,
std::reference_wrapper<float(*)()> >::value), "");
static_assert((std::is_base_of<std::unary_function<int, float>,
std::reference_wrapper<float (int)> >::value), "");
static_assert((!std::is_base_of<std::unary_function<int, float>,
std::reference_wrapper<float (int, int)> >::value), "");
static_assert((std::is_base_of<std::unary_function<int, float>,
std::reference_wrapper<float(*)(int)> >::value), "");
static_assert((!std::is_base_of<std::unary_function<int, float>,
std::reference_wrapper<float(*)(int, int)> >::value), "");
static_assert((std::is_base_of<std::unary_function<C*, float>,
std::reference_wrapper<float(C::*)()> >::value), "");
static_assert((std::is_base_of<std::unary_function<const volatile C*, float>,
std::reference_wrapper<float(C::*)() const volatile> >::value), "");
static_assert((!std::is_base_of<std::unary_function<C*, float>,
std::reference_wrapper<float(C::*)(int)> >::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// check for deriving from unary_function
#include <functional>
#include <type_traits>
class functor1
: public std::unary_function<int, char>
{
};
class functor2
: public std::binary_function<char, int, double>
{
};
class functor3
: public std::unary_function<int, int>,
public std::binary_function<char, int, double>
{
public:
typedef float result_type;
};
class functor4
: public std::unary_function<int, int>,
public std::binary_function<char, int, double>
{
public:
};
struct C
{
typedef int argument_type;
typedef int result_type;
};
int main()
{
stati
c_assert((std::is_base_of<std::unary_function<int, char>,
std::reference_wrapper<functor1> >::value), "");
static_assert((!std::is_base_of<std::unary_function<char, int>,
std::reference_wrapper<functor2> >::value), "");
static_assert((std::is_base_of<std::unary_function<int, int>,
std::reference_wrapper<functor3> >::value), "");
static_assert((std::is_base_of<std::unary_function<int, int>,
std::reference_wrapper<functor4> >::value), "");
static_assert((!std::is_base_of<std::unary_function<int, int>,
std::reference_wrapper<C> >::value), "");
static_assert((!std::is_base_of<std::unary_function<int, float>,
std::reference_wrapper<float(*)()> >::value), "");
static_assert((std::is_base_of<std::unary_function<int, float>,
std::reference_wrapper<float (int)> >::value), "");
static_assert((!std::is_base_of<std::unary_function<int, float>,
std::reference_wrapper<float (int, int)> >::value), "");
static_assert((std::is_base_of<std::unary_function<int, float>,
std::reference_wrapper<float(*)(int)> >::value), "");
static_assert((!std::is_base_of<std::unary_function<int, float>,
std::reference_wrapper<float(*)(int, int)> >::value), "");
static_assert((std::is_base_of<std::unary_function<C*, float>,
std::reference_wrapper<float(C::*)()> >::value), "");
static_assert((std::is_base_of<std::unary_function<const volatile C*, float>,
std::reference_wrapper<float(C::*)() const volatile> >::value), "");
static_assert((!std::is_base_of<std::unary_function<C*, float>,
std::reference_wrapper<float(C::*)(int)> >::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/refwrap/weak_result.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/weak_result.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/weak_result.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/weak_result.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// has weak result type
#include <functional>
#include <type_traits>
class functor1
: public std::unary_function<int, char>
{
};
class functor2
: public std::binary_function<char, int, double>
{
};
class functor3
: public std::unary_function<char, int>,
public std::binary_function<char, int, double>
{
public:
typedef float result_type;
};
class functor4
: public std::unary_function<char, int>,
public std::binary_function<char, int, double>
{
public:
};
class C {};
template <class T>
struct has_result_type
{
private:
struct two {char _; cha
r __;};
template <class U> static two test(...);
template <class U> static char test(typename U::result_type* = 0);
public:
static const bool value = sizeof(test<T>(0)) == 1;
};
int main()
{
static_assert((std::is_same<std::reference_wrapper<functor1>::result_type,
char>::value), "");
static_assert((std::is_same<std::reference_wrapper<functor2>::result_type,
double>::value), "");
static_assert((std::is_same<std::reference_wrapper<functor3>::result_type,
float>::value), "");
static_assert((std::is_same<std::reference_wrapper<void()>::result_type,
void>::value), "");
static_assert((std::is_same<std::reference_wrapper<int*(double*)>::result_type,
int*>::value), "");
static_assert((std::is_same<std::reference_wrapper<void(*)()>::result_type,
void>::value
), "");
static_assert((std::is_same<std::reference_wrapper<int*(*)(double*)>::result_type,
int*>::value), "");
static_assert((std::is_same<std::reference_wrapper<int*(C::*)(double*)>::result_type,
int*>::value), "");
static_assert((std::is_same<std::reference_wrapper<int (C::*)(double*) const volatile>::result_type,
int>::value), "");
static_assert((std::is_same<std::reference_wrapper<C()>::result_type,
C>::value), "");
static_assert(has_result_type<std::reference_wrapper<functor3> >::value, "");
static_assert(!has_result_type<std::reference_wrapper<functor4> >::value, "");
static_assert(!has_result_type<std::reference_wrapper<C> >::value, "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
// reference_wrapper
// has weak result type
#include <functional>
#include <type_traits>
class functor1
: public std::unary_function<int, char>
{
};
class functor2
: public std::binary_function<char, int, double>
{
};
class functor3
: public std::unary_function<char, int>,
public std::binary_function<char, int, double>
{
public:
typedef float result_type;
};
class functor4
: public std::unary_function<char, int>,
public std::binary_function<char, int, double>
{
public:
};
class C {};
template <class T>
struct has_result_type
{
private:
struct two {char _; char __;};
template
<class U> static two test(...);
template <class U> static char test(typename U::result_type* = 0);
public:
static const bool value = sizeof(test<T>(0)) == 1;
};
int main()
{
static_assert((std::is_same<std::reference_wrapper<functor1>::result_type,
char>::value), "");
static_assert((std::is_same<std::reference_wrapper<functor2>::result_type,
double>::value), "");
static_assert((std::is_same<std::reference_wrapper<functor3>::result_type,
float>::value), "");
static_assert((std::is_same<std::reference_wrapper<void()>::result_type,
void>::value), "");
static_assert((std::is_same<std::reference_wrapper<int*(double*)>::result_type,
int*>::value), "");
static_assert((std::is_same<std::reference_wrapper<void(*)()>::result_type,
void>::value), "");
static_a
ssert((std::is_same<std::reference_wrapper<int*(*)(double*)>::result_type,
int*>::value), "");
static_assert((std::is_same<std::reference_wrapper<int*(C::*)(double*)>::result_type,
int*>::value), "");
static_assert((std::is_same<std::reference_wrapper<int (C::*)(double*) const volatile>::result_type,
int>::value), "");
static_assert((std::is_same<std::reference_wrapper<C()>::result_type,
C>::value), "");
static_assert(has_result_type<std::reference_wrapper<functor3> >::value, "");
static_assert(!has_result_type<std::reference_wrapper<functor4> >::value, "");
static_assert(!has_result_type<std::reference_wrapper<C> >::value, "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/function.objects/unord.hash/floating.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/unord.hash/floating.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/unord.hash/floating.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/unord.hash/floating.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/function.objects/unord.hash/integral.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/unord.hash/integral.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/unord.hash/integral.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/unord.hash/integral.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/function.objects/unord.hash/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/unord.hash/pointer.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/unord.hash/pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/unord.hash/pointer.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/function.objects/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/version.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/version.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/version.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
#include <functional>
#ifndef _LIBCPP_VERSION
#error _LIBCPP_VERSION not defined
#endif
int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <functional>
#include <functional>
#ifndef _LIBCPP_VERSION
#error _LIBCPP_VERSION not defined
#endif
int main()
{
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/types.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/types.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/types.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/allocator.tag/allocator_arg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.tag/allocator_arg.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.tag/allocator_arg.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.tag/allocator_arg.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// struct allocator_arg_t { };
// const allocator_arg_t allocator_arg = allocator_arg_t();
#include <memory>
void test(std::allocator_arg_t) {}
int main()
{
test(std::allocator_arg);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// struct allocator_arg_t { };
// const allocator_arg_t allocator_arg = allocator_arg_t();
#include <memory>
void test(std::allocator_arg_t) {}
int main()
{
test(std::allocator_arg);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// static pointer allocate(allocator_type& a, size_type n);
// ...
// };
#include <memory>
#include <cassert>
template <class T>
struct A
{
typedef T value_type;
value_type* allocate(std::size_t n)
{
assert(n == 10);
return (value_type*)0xDEADBEEF;
}
};
int main()
{
A<int> a;
assert(std::allocator_traits<A<int> >::allocate(a, 10) == (int*)0xDEADBEEF);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// static pointer allocate(allocator_type& a, size_type n);
// ...
// };
#include <memory>
#include <cassert>
template <class T>
struct A
{
typedef T value_type;
value_type* allocate(std::size_t n)
{
assert(n == 10);
return (value_type*)0xDEADBEEF;
}
};
int main()
{
A<int> a;
assert(std::allocator_traits<A<int> >::allocate(a, 10) == (int*)0xDEADBEEF);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// static pointer allocate(allocator_type& a, size_type n, const_void_pointer hint);
// ...
// };
#include <memory>
#include <cassert>
template <class T>
struct A
{
typedef T value_type;
value_type* allocate(std::size_t n)
{
assert(n == 10);
return (value_type*)0xDEADBEEF;
}
};
template <class T>
struct B
{
typedef T value_type;
value_type* allocate(std::size_t n)
{
assert(n == 12);
return (value_type*)0xEEADBEEF;
}
value_type* allocate(std::size_t n, const void* p)
{
assert(n == 11);
assert(p == 0);
return (value_type*)0xFEADBEEF;
}
};
int main()
{
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
A<int> a;
assert(std::allocator_traits<A<int> >::allocate(a, 10, nullptr) == (int*)0xDEADBEEF);
#endif
B<int> b;
assert(std::allocator_traits<B<int> >::allocate(b, 11, nullptr) == (int*)0xFEADBEEF);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// static pointer allocate(allocator_type& a, size_type n, const_void_pointer hint);
// ...
// };
#include <memory>
#include <cassert>
template <class T>
struct A
{
typedef T value_type;
value_type* allocate(std::size_t n)
{
assert(n == 10);
return (value_type*)0xDEADBEEF;
}
};
template <class T>
struct B
{
typedef T value_type;
value_type* allocate(std::size_t n)
{
assert(n == 12);
return (value_type*)0xEEADBEEF;
}
value_type* allocate(std::size_t n, const void* p)
{
assert(n =
= 11);
assert(p == 0);
return (value_type*)0xFEADBEEF;
}
};
int main()
{
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
A<int> a;
assert(std::allocator_traits<A<int> >::allocate(a, 10, nullptr) == (int*)0xDEADBEEF);
#endif
B<int> b;
assert(std::allocator_traits<B<int> >::allocate(b, 11, nullptr) == (int*)0xFEADBEEF);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// template <class Ptr, class... Args>
// static void construct(allocator_type& a, Ptr p, Args&&... args);
// ...
// };
#include <memory>
#include <new>
#include <type_traits>
#include <cassert>
template <class T>
struct A
{
typedef T value_type;
};
int b_construct = 0;
template <class T>
struct B
{
typedef T value_type;
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class U, class ...Args>
void construct(U* p, Args&& ...args)
{
++b_construct;
::new ((void*)p) U(std::forward<Args>(args)...);
}
#endif
};
struct A0
{
static int count;
A0() {++count;}
};
int A0::count = 0;
struct A1
{
static int count;
A1(char c)
{
assert(c == 'c');
++count;
}
};
int A1::count = 0;
struct A2
{
static int count;
A2(char c, int i)
{
assert(c == 'd');
assert(i == 5);
++count;
}
};
int A2::count = 0;
int main()
{
{
A0::count = 0;
A<int> a;
std::aligned_storage<sizeof(A0)>::type a0;
assert(A0::count == 0);
std::allocator_traits<A<int> >::construct(a, (A0*)&a0);
assert(A0::count == 1);
}
{
A1::count = 0;
A<int> a;
std::aligned_storage<sizeof(A1)>::type a1;
assert(A1::count == 0);
std::allocator_traits<A<int> >::construct(a, (A1*)&a1, 'c');
assert(A1::count == 1);
}
{
A2::count = 0;
A<int> a;
std::aligned_storage<sizeof(A2)>::type a2;
assert(A2::count == 0);
std::allocator_traits<A<int> >::construct(a, (A2*)&a2, 'd', 5);
assert(A2::count == 1);
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
{
A0::count = 0;
b_construct = 0;
B<int> b;
std::aligned_storage<sizeof(A0)>::type a0;
assert(A0::count == 0);
assert(b_construct == 0);
std::allocator_traits<B<int> >::construct(b, (A0*)&a0);
assert(A0::count == 1);
assert(b_construct == 1);
}
{
A1::count = 0;
b_construct = 0;
B<int> b;
std::aligned_storage<sizeof(A1)>::type a1;
assert(A1::count == 0);
assert(b_construct == 0);
std::allocator_traits<B<int> >::construct(b, (A1*)&a1, 'c');
assert(A1::count == 1);
assert(b_construct == 1);
}
{
A2::count = 0;
b_construct = 0;
B<int> b;
std::aligned_storage<sizeof(A2)>::type a2;
assert(A2::count == 0);
assert(b_construct == 0);
std::allocator_traits<B<int> >::construct(b, (A2*)&a2, 'd', 5);
assert(A2::count == 1);
assert(b_construct == 1);
}
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// template <class Ptr, class... Args>
// static void construct(allocator_type& a, Ptr p, Args&&... args);
// ...
// };
#include <memory>
#include <new>
#include <type_traits>
#include <cassert>
template <class T>
struct A
{
typedef T value_type;
};
int b_construct = 0;
template <class T>
struct B
{
typedef T value_type;
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class U, class ...Args>
void construct(U* p, Args&& ...args)
{
++b_construct;
::new ((void*)p) U(std::forward<Args>(args)...);
}
#endif
};
struct A
0
{
static int count;
A0() {++count;}
};
int A0::count = 0;
struct A1
{
static int count;
A1(char c)
{
assert(c == 'c');
++count;
}
};
int A1::count = 0;
struct A2
{
static int count;
A2(char c, int i)
{
assert(c == 'd');
assert(i == 5);
++count;
}
};
int A2::count = 0;
int main()
{
{
A0::count = 0;
A<int> a;
std::aligned_storage<sizeof(A0)>::type a0;
assert(A0::count == 0);
std::allocator_traits<A<int> >::construct(a, (A0*)&a0);
assert(A0::count == 1);
}
{
A1::count = 0;
A<int> a;
std::aligned_storage<sizeof(A1)>::type a1;
assert(A1::count == 0);
std::allocator_traits<A<int> >::construct(a, (A1*)&a1, 'c');
assert(A1::count == 1);
}
{
A2::count = 0;
A<int> a;
std::aligned_storage<sizeof(A2)>::type a2;
assert(A2::count == 0);
std::allocat
or_traits<A<int> >::construct(a, (A2*)&a2, 'd', 5);
assert(A2::count == 1);
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
{
A0::count = 0;
b_construct = 0;
B<int> b;
std::aligned_storage<sizeof(A0)>::type a0;
assert(A0::count == 0);
assert(b_construct == 0);
std::allocator_traits<B<int> >::construct(b, (A0*)&a0);
assert(A0::count == 1);
assert(b_construct == 1);
}
{
A1::count = 0;
b_construct = 0;
B<int> b;
std::aligned_storage<sizeof(A1)>::type a1;
assert(A1::count == 0);
assert(b_construct == 0);
std::allocator_traits<B<int> >::construct(b, (A1*)&a1, 'c');
assert(A1::count == 1);
assert(b_construct == 1);
}
{
A2::count = 0;
b_construct = 0;
B<int> b;
std::aligned_storage<sizeof(A2)>::type a2;
assert(A2::count == 0);
assert(b_construct == 0);
std::allocator
_traits<B<int> >::construct(b, (A2*)&a2, 'd', 5);
assert(A2::count == 1);
assert(b_construct == 1);
}
#endif
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// static void deallocate(allocator_type& a, pointer p, size_type n);
// ...
// };
#include <memory>
#include <cassert>
int called = 0;
template <class T>
struct A
{
typedef T value_type;
void deallocate(value_type* p, std::size_t n)
{
assert(p == (value_type*)0xDEADBEEF);
assert(n == 10);
++called;
}
};
int main()
{
A<int> a;
std::allocator_traits<A<int> >::deallocate(a, (int*)0xDEADBEEF, 10);
assert(called == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// static void deallocate(allocator_type& a, pointer p, size_type n);
// ...
// };
#include <memory>
#include <cassert>
int called = 0;
template <class T>
struct A
{
typedef T value_type;
void deallocate(value_type* p, std::size_t n)
{
assert(p == (value_type*)0xDEADBEEF);
assert(n == 10);
++called;
}
};
int main()
{
A<int> a;
std::allocator_traits<A<int> >::deallocate(a, (int*)0xDEADBEEF, 10);
assert(called == 1);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// template <class Ptr>
// static void destroy(allocator_type& a, Ptr p);
// ...
// };
#include <memory>
#include <new>
#include <type_traits>
#include <cassert>
template <class T>
struct A
{
typedef T value_type;
};
int b_destroy = 0;
template <class T>
struct B
{
typedef T value_type;
template <class U>
void destroy(U* p)
{
++b_destroy;
p->~U();
}
};
struct A0
{
static int count;
~A0() {++count;}
};
int A0::count = 0;
int main()
{
{
A0::count = 0;
A<int> a;
std::aligned_storage<sizeof(A0)>::type a0;
std::allocator_traits<A<int> >::construct(a, (A0*)&a0);
assert(A0::count == 0);
std::allocator_traits<A<int> >::destroy(a, (A0*)&a0);
assert(A0::count == 1);
}
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
{
A0::count = 0;
b_destroy = 0;
B<int> b;
std::aligned_storage<sizeof(A0)>::type a0;
std::allocator_traits<B<int> >::construct(b, (A0*)&a0);
assert(A0::count == 0);
assert(b_destroy == 0);
std::allocator_traits<B<int> >::destroy(b, (A0*)&a0);
assert(A0::count == 1);
assert(b_destroy == 1);
}
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// template <class Ptr>
// static void destroy(allocator_type& a, Ptr p);
// ...
// };
#include <memory>
#include <new>
#include <type_traits>
#include <cassert>
template <class T>
struct A
{
typedef T value_type;
};
int b_destroy = 0;
template <class T>
struct B
{
typedef T value_type;
template <class U>
void destroy(U* p)
{
++b_destroy;
p->~U();
}
};
struct A0
{
static int count;
~A0() {++count;}
};
int A0::count = 0;
int main()
{
{
A0::count = 0;
A<int> a;
std::aligne
d_storage<sizeof(A0)>::type a0;
std::allocator_traits<A<int> >::construct(a, (A0*)&a0);
assert(A0::count == 0);
std::allocator_traits<A<int> >::destroy(a, (A0*)&a0);
assert(A0::count == 1);
}
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
{
A0::count = 0;
b_destroy = 0;
B<int> b;
std::aligned_storage<sizeof(A0)>::type a0;
std::allocator_traits<B<int> >::construct(b, (A0*)&a0);
assert(A0::count == 0);
assert(b_destroy == 0);
std::allocator_traits<B<int> >::destroy(b, (A0*)&a0);
assert(A0::count == 1);
assert(b_destroy == 1);
}
#endif
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// static size_type max_size(const allocator_type& a);
// ...
// };
#include <memory>
#include <new>
#include <type_traits>
#include <cassert>
template <class T>
struct A
{
typedef T value_type;
};
template <class T>
struct B
{
typedef T value_type;
size_t max_size() const
{
return 100;
}
};
int main()
{
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
{
A<int> a;
assert(std::allocator_traits<A<int> >::max_size(a) ==
std::numeric_limits<std::size_t>::max());
}
{
const
A<int> a = {};
assert(std::allocator_traits<A<int> >::max_size(a) ==
std::numeric_limits<std::size_t>::max());
}
#endif
{
B<int> b;
assert(std::allocator_traits<B<int> >::max_size(b) == 100);
}
{
const B<int> b = {};
assert(std::allocator_traits<B<int> >::max_size(b) == 100);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// static size_type max_size(const allocator_type& a);
// ...
// };
#include <memory>
#include <new>
#include <type_traits>
#include <cassert>
template <class T>
struct A
{
typedef T value_type;
};
template <class T>
struct B
{
typedef T value_type;
size_t max_size() const
{
return 100;
}
};
int main()
{
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
{
A<int> a;
assert(std::allocator_traits<A<int> >::max_size(a) ==
std::numeric_limits<std::size_t>::max());
}
{
const A<int> a = {};
assert(std::allocator_traits<A<int> >::max_size(a) ==
std::numeric_limits<std::size_t>::max());
}
#endif
{
B<int> b;
assert(std::allocator_traits<B<int> >::max_size(b) == 100);
}
{
const B<int> b = {};
assert(std::allocator_traits<B<int> >::max_size(b) == 100);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// static allocator_type
// select_on_container_copy_construction(const allocator_type& a);
// ...
// };
#include <memory>
#include <new>
#include <type_traits>
#include <cassert>
template <class T>
struct A
{
typedef T value_type;
int id;
explicit A(int i = 0) : id(i) {}
};
template <class T>
struct B
{
typedef T value_type;
int id;
explicit B(int i = 0) : id(i) {}
B select_on_container_copy_construction() const
{
return B(100);
}
};
int main()
{
{
A<int> a;
asser
t(std::allocator_traits<A<int> >::select_on_container_copy_construction(a).id == 0);
}
{
const A<int> a(0);
assert(std::allocator_traits<A<int> >::select_on_container_copy_construction(a).id == 0);
}
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
{
B<int> b;
assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100);
}
{
const B<int> b(0);
assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100);
}
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// static allocator_type
// select_on_container_copy_construction(const allocator_type& a);
// ...
// };
#include <memory>
#include <new>
#include <type_traits>
#include <cassert>
template <class T>
struct A
{
typedef T value_type;
int id;
explicit A(int i = 0) : id(i) {}
};
template <class T>
struct B
{
typedef T value_type;
int id;
explicit B(int i = 0) : id(i) {}
B select_on_container_copy_construction() const
{
return B(100);
}
};
int main()
{
{
A<int> a;
assert(std::allocator_tra
its<A<int> >::select_on_container_copy_construction(a).id == 0);
}
{
const A<int> a(0);
assert(std::allocator_traits<A<int> >::select_on_container_copy_construction(a).id == 0);
}
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
{
B<int> b;
assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100);
}
{
const B<int> b(0);
assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100);
}
#endif
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::const_pointer
// | pointer_traits<pointer>::rebind<const value_type>
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct Ptr {};
template <class T>
struct A
{
typedef T value_type;
typedef Ptr<T> pointer;
};
template <class T>
struct B
{
typedef T value_type;
};
template <class T>
struct CPtr {};
template <class T>
struct C
{
typedef T value_type;
typedef CPtr<T> pointer;
typedef CPtr<const T> const_pointer;
};
int main()
{
static_assert((std::is_same<s
td::allocator_traits<A<char> >::const_pointer, Ptr<const char> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::const_pointer, const char*>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::const_pointer, CPtr<const char> >::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::const_pointer
// | pointer_traits<pointer>::rebind<const value_type>
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct Ptr {};
template <class T>
struct A
{
typedef T value_type;
typedef Ptr<T> pointer;
};
template <class T>
struct B
{
typedef T value_type;
};
template <class T>
struct CPtr {};
template <class T>
struct C
{
typedef T value_type;
typedef CPtr<T> pointer;
typedef CPtr<const T> const_pointer;
};
int main()
{
static_assert((std::is_same<std::allocator_traits
<A<char> >::const_pointer, Ptr<const char> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::const_pointer, const char*>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::const_pointer, CPtr<const char> >::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::const_void_pointer
// | pointer_traits<pointer>::rebind<const void>
// const_void_pointer;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct Ptr {};
template <class T>
struct A
{
typedef T value_type;
typedef Ptr<T> pointer;
};
template <class T>
struct B
{
typedef T value_type;
};
template <class T>
struct CPtr {};
template <class T>
struct C
{
typedef T value_type;
typedef CPtr<const void> const_void_pointer;
};
int
main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::const_void_pointer, Ptr<const void> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::const_void_pointer, const void*>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::const_void_pointer, CPtr<const void> >::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::const_void_pointer
// | pointer_traits<pointer>::rebind<const void>
// const_void_pointer;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct Ptr {};
template <class T>
struct A
{
typedef T value_type;
typedef Ptr<T> pointer;
};
template <class T>
struct B
{
typedef T value_type;
};
template <class T>
struct CPtr {};
template <class T>
struct C
{
typedef T value_type;
typedef CPtr<const void> const_void_pointer;
};
int main()
{
static_
assert((std::is_same<std::allocator_traits<A<char> >::const_void_pointer, Ptr<const void> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::const_void_pointer, const void*>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::const_void_pointer, CPtr<const void> >::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::difference_type
// | ptrdiff_t difference_type;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
typedef short difference_type;
};
template <class T>
struct B
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::difference_type, short>::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::difference_type, std::ptrdiff_t>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::difference_type
// | ptrdiff_t difference_type;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
typedef short difference_type;
};
template <class T>
struct B
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::difference_type, short>::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::difference_type, std::ptrdiff_t>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::pointer | value_type* pointer;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct Ptr {};
template <class T>
struct A
{
typedef T value_type;
typedef Ptr<T> pointer;
};
template <class T>
struct B
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::pointer, Ptr<char> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::pointer, char*>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::pointer | value_type* pointer;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct Ptr {};
template <class T>
struct A
{
typedef T value_type;
typedef Ptr<T> pointer;
};
template <class T>
struct B
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::pointer, Ptr<char> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::pointer, char*>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::propagate_on_container_copy_assignment
// | false_type propagate_on_container_copy_assignment;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
typedef std::true_type propagate_on_container_copy_assignment;
};
template <class T>
struct B
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_copy_assignment, std::true_type>::value), "");
static_asser
t((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_copy_assignment, std::false_type>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::propagate_on_container_copy_assignment
// | false_type propagate_on_container_copy_assignment;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
typedef std::true_type propagate_on_container_copy_assignment;
};
template <class T>
struct B
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_copy_assignment, std::true_type>::value), "");
static_assert((std::is_same<std:
:allocator_traits<B<char> >::propagate_on_container_copy_assignment, std::false_type>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::propagate_on_container_move_assignment
// | false_type propagate_on_container_move_assignment;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
typedef std::true_type propagate_on_container_move_assignment;
};
template <class T>
struct B
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_move_assignment, std::true_type>::value), "");
static_asser
t((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_move_assignment, std::false_type>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::propagate_on_container_move_assignment
// | false_type propagate_on_container_move_assignment;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
typedef std::true_type propagate_on_container_move_assignment;
};
template <class T>
struct B
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_move_assignment, std::true_type>::value), "");
static_assert((std::is_same<std:
:allocator_traits<B<char> >::propagate_on_container_move_assignment, std::false_type>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::propagate_on_container_swap
// | false_type propagate_on_container_swap;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
typedef std::true_type propagate_on_container_swap;
};
template <class T>
struct B
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_swap, std::true_type>::value), "");
static_assert((std::is_same<std::allocator_traits<B<char
> >::propagate_on_container_swap, std::false_type>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::propagate_on_container_swap
// | false_type propagate_on_container_swap;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
typedef std::true_type propagate_on_container_swap;
};
template <class T>
struct B
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_swap, std::true_type>::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_co
ntainer_swap, std::false_type>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// template <class T> using rebind_alloc = Alloc::rebind<U>::other | Alloc<T, Args...>;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct ReboundA {};
template <class T>
struct A
{
typedef T value_type;
template <class U> struct rebind {typedef ReboundA<U> other;};
};
template <class T, class U>
struct ReboundB {};
template <class T, class U>
struct B
{
typedef T value_type;
template <class V> struct rebind {typedef ReboundB<V, U> other;};
};
template <class T>
struct C
{
typedef T va
lue_type;
};
template <class T, class U>
struct D
{
typedef T value_type;
};
template <class T>
struct E
{
typedef T value_type;
template <class U> struct rebind {typedef ReboundA<U> otter;};
};
int main()
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>, ReboundA<double> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>, ReboundB<double, char> >::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>, C<double> >::value), "");
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>, D<double, char> >::value), "");
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>, E<double> >::value), "");
#else
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>::other, ReboundA<double> >::valu
e), "");
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>::other, ReboundB<double, char> >::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>::other, C<double> >::value), "");
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>::other, D<double, char> >::value), "");
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>::other, E<double> >::value), "");
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// template <class T> using rebind_alloc = Alloc::rebind<U>::other | Alloc<T, Args...>;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct ReboundA {};
template <class T>
struct A
{
typedef T value_type;
template <class U> struct rebind {typedef ReboundA<U> other;};
};
template <class T, class U>
struct ReboundB {};
template <class T, class U>
struct B
{
typedef T value_type;
template <class V> struct rebind {typedef ReboundB<V, U> other;};
};
template <class T>
struct C
{
typedef T value_type;
};
templa
te <class T, class U>
struct D
{
typedef T value_type;
};
template <class T>
struct E
{
typedef T value_type;
template <class U> struct rebind {typedef ReboundA<U> otter;};
};
int main()
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>, ReboundA<double> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>, ReboundB<double, char> >::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>, C<double> >::value), "");
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>, D<double, char> >::value), "");
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>, E<double> >::value), "");
#else
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>::other, ReboundA<double> >::value), "");
static_
assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>::other, ReboundB<double, char> >::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>::other, C<double> >::value), "");
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>::other, D<double, char> >::value), "");
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>::other, E<double> >::value), "");
#endif
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::size_type | size_t size_type;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
typedef unsigned short size_type;
};
template <class T>
struct B
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::size_type, unsigned short>::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::size_type, std::size_t>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::size_type | size_t size_type;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
typedef unsigned short size_type;
};
template <class T>
struct B
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::size_type, unsigned short>::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::size_type, std::size_t>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::void_pointer
// | pointer_traits<pointer>::rebind<void>
// void_pointer;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct Ptr {};
template <class T>
struct A
{
typedef T value_type;
typedef Ptr<T> pointer;
};
template <class T>
struct B
{
typedef T value_type;
};
template <class T>
struct CPtr {};
template <class T>
struct C
{
typedef T value_type;
typedef CPtr<void> void_pointer;
};
int main()
{
static_assert((st
d::is_same<std::allocator_traits<A<char> >::void_pointer, Ptr<void> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::void_pointer, void*>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::void_pointer, CPtr<void> >::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc::void_pointer
// | pointer_traits<pointer>::rebind<void>
// void_pointer;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct Ptr {};
template <class T>
struct A
{
typedef T value_type;
typedef Ptr<T> pointer;
};
template <class T>
struct B
{
typedef T value_type;
};
template <class T>
struct CPtr {};
template <class T>
struct C
{
typedef T value_type;
typedef CPtr<void> void_pointer;
};
int main()
{
static_assert((std::is_same<std::allo
cator_traits<A<char> >::void_pointer, Ptr<void> >::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::void_pointer, void*>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::void_pointer, CPtr<void> >::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator_type.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator_type.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc allocator_type;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::allocator_type, A<char> >::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef Alloc allocator_type;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::allocator_type, A<char> >::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/rebind_traits.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/rebind_traits.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/rebind_traits.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/rebind_traits.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct ReboundA {};
template <class T>
struct A
{
typedef T value_type;
template <class U> struct rebind {typedef ReboundA<U> other;};
};
template <class T, class U>
struct ReboundB {};
template <class T, class U>
struct B
{
typedef T value_type;
template <class V> struct rebind {typedef ReboundB<V, U> other;};
};
template <class T>
struct C
{
typedef T value_type;
};
template <class T, class U>
struct D
{
typedef T value_type;
};
template <class T>
struct E
{
typedef T value_type;
template <class U> struct rebind {typedef ReboundA<U> otter;};
};
int main()
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>, std::allocator_traits<ReboundA<double> > >::value), "");
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>, std::allocator_traits<ReboundB<double, char> > >::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>, std::allocator_traits<C<double> > >::value), "");
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>, std::allocator_traits<D<double, char> > >::value), "");
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>, std::allocator_traits<E<double> > >::value), "");
#else
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>::other, std::allocator_traits<ReboundA<double> > >::value), "");
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>::other, std::allocator_traits<ReboundB<double, char> > >::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>::other, std::allocator_traits<C<double> > >::value), "");
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>::other, std::allocator_traits<D<double, char> > >::value), "");
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>::other, std::allocator_traits<E<double> > >::value), "");
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct ReboundA {};
template <class T>
struct A
{
typedef T value_type;
template <class U> struct rebind {typedef ReboundA<U> other;};
};
template <class T, class U>
struct ReboundB {};
template <class T, class U>
struct B
{
typedef T value_type;
template <class V> struct rebind {typedef ReboundB<V, U> other;};
};
template <class T>
struct C
{
typedef T value_type;
};
template <class
T, class U>
struct D
{
typedef T value_type;
};
template <class T>
struct E
{
typedef T value_type;
template <class U> struct rebind {typedef ReboundA<U> otter;};
};
int main()
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>, std::allocator_traits<ReboundA<double> > >::value), "");
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>, std::allocator_traits<ReboundB<double, char> > >::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>, std::allocator_traits<C<double> > >::value), "");
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>, std::allocator_traits<D<double, char> > >::value), "");
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>, std::allocator_traits<E<double> > >::value), "");
#else
static_assert((std:
:is_same<std::allocator_traits<A<char> >::rebind_traits<double>::other, std::allocator_traits<ReboundA<double> > >::value), "");
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>::other, std::allocator_traits<ReboundB<double, char> > >::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>::other, std::allocator_traits<C<double> > >::value), "");
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>::other, std::allocator_traits<D<double, char> > >::value), "");
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>::other, std::allocator_traits<E<double> > >::value), "");
#endif
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.traits/value_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/value_type.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/value_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/value_type.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef typename Alloc::value_type value_type;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::value_type, char>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Alloc>
// struct allocator_traits
// {
// typedef typename Alloc::value_type value_type;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
typedef T value_type;
};
int main()
{
static_assert((std::is_same<std::allocator_traits<A<char> >::value_type, char>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.construction/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.construction/tested_elsewhere.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.construction/tested_elsewhere.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.construction/tested_elsewhere.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T, class Alloc> struct uses_allocator;
#include <memory>
#include <vector>
struct A
{
};
struct B
{
typedef int allocator_type;
};
int main()
{
static_assert((!std::uses_allocator<int, std::allocator<int> >::value), "");
static_assert(( std::uses_allocator<std::vector<int>, std::allocator<int> >::value), "");
static_assert((!std::uses_allocator<A, std::allocator<int> >::value), "");
static_assert((!std::uses_allocator<B, std::allocator<int> >::value), "");
static_assert(( std::uses_allocator<B, double>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T, class Alloc> struct uses_allocator;
#include <memory>
#include <vector>
struct A
{
};
struct B
{
typedef int allocator_type;
};
int main()
{
static_assert((!std::uses_allocator<int, std::allocator<int> >::value), "");
static_assert(( std::uses_allocator<std::vector<int>, std::allocator<int> >::value), "");
static_assert((!std::uses_allocator<A, std::allocator<int> >::value), "");
static_assert((!std::uses_allocator<B, std::allocator<int> >::value), "");
static_assert(( std::uses_allocator<B, double>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/allocator.uses/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.uses/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.uses/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.uses/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/c.malloc/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/c.malloc/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/c.malloc/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/c.malloc/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <cstdlib> and <cstring> are already tested elsewhere
int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <cstdlib> and <cstring> are already tested elsewhere
int main()
{
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator.globals/eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator.globals/eq.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator.globals/eq.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator.globals/eq.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// allocator:
// template <class T1, class T2>
// bool
// operator==(const allocator<T1>&, const allocator<T2>&) throw();
//
// template <class T1, class T2>
// bool
// operator!=(const allocator<T1>&, const allocator<T2>&) throw();
#include <memory>
#include <cassert>
int main()
{
std::allocator<int> a1;
std::allocator<int> a2;
assert(a1 == a2);
assert(!(a1 != a2));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// allocator:
// template <class T1, class T2>
// bool
// operator==(const allocator<T1>&, const allocator<T2>&) throw();
//
// template <class T1, class T2>
// bool
// operator!=(const allocator<T1>&, const allocator<T2>&) throw();
#include <memory>
#include <cassert>
int main()
{
std::allocator<int> a1;
std::allocator<int> a2;
assert(a1 == a2);
assert(!(a1 != a2));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/address.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/address.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/address.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/address.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// allocator:
// pointer address(reference x) const;
// const_pointer address(const_reference x) const;
#include <memory>
#include <cassert>
template <class T>
void test_address()
{
T* tp = new T();
const T* ctp = tp;
const std::allocator<T> a;
assert(a.address(*tp) == tp);
assert(a.address(*ctp) == tp);
delete tp;
}
struct A
{
void operator&() const {}
};
int main()
{
test_address<int>();
test_address<A>();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// allocator:
// pointer address(reference x) const;
// const_pointer address(const_reference x) const;
#include <memory>
#include <cassert>
template <class T>
void test_address()
{
T* tp = new T();
const T* ctp = tp;
const std::allocator<T> a;
assert(a.address(*tp) == tp);
assert(a.address(*ctp) == tp);
delete tp;
}
struct A
{
void operator&() const {}
};
int main()
{
test_address<int>();
test_address<A>();
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// allocator:
// pointer allocate(size_type n, allocator<void>::const_pointer hint=0);
#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
assert(s == 3 * sizeof(int));
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
int A_constructed = 0;
struct A
{
int data;
A() {++A_constructed;}
A(const A&) {++A_constructed;}
~A() {--A_constructed;}
};
int main()
{
std::allocator<A> a;
assert(new_called == 0);
assert(A_constructed == 0);
A* ap = a.allocate(3);
assert(new_called == 1);
assert(A_constructed == 0);
a.deallocate(ap, 3);
assert(new_called == 0);
assert(A_constructed == 0);
A* ap2 = a.allocate(3, (const void*)5);
assert(new_called == 1);
assert(A_constructed == 0);
a.deallocate(ap2, 3);
assert(new_called == 0);
assert(A_constructed == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// allocator:
// pointer allocate(size_type n, allocator<void>::const_pointer hint=0);
#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
assert(s == 3 * sizeof(int));
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
int A_constructed = 0;
struct A
{
int data;
A() {++A_constructed;}
A(const A&) {++A_constructed;}
~A() {--A_constructed;}
};
int main()
{
std::allocator<A> a;
assert(new_called == 0);
assert(A_constructe
d == 0);
A* ap = a.allocate(3);
assert(new_called == 1);
assert(A_constructed == 0);
a.deallocate(ap, 3);
assert(new_called == 0);
assert(A_constructed == 0);
A* ap2 = a.allocate(3, (const void*)5);
assert(new_called == 1);
assert(A_constructed == 0);
a.deallocate(ap2, 3);
assert(new_called == 0);
assert(A_constructed == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// allocator:
// template <class... Args> void construct(pointer p, Args&&... args);
#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
assert(s == 3 * sizeof(int));
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
int A_constructed = 0;
struct A
{
int data;
A() {++A_constructed;}
A(const A&) {++A_constructed;}
explicit A(int) {++A_constructed;}
A(int, int*) {++A_constructed;}
~A() {--A_constructed;
}
};
int move_only_constructed = 0;
class move_only
{
int data;
#ifdef _LIBCPP_MOVE
move_only(const move_only&);
move_only& operator=(const move_only&);
#else
move_only(move_only&);
move_only& operator=(move_only&);
#endif
public:
#ifdef _LIBCPP_MOVE
move_only(move_only&&) {++move_only_constructed;}
move_only& operator=(move_only&&) {}
#else
operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
move_only(std::__rv<move_only>) {++move_only_constructed;}
#endif
move_only() {++move_only_constructed;}
~move_only() {--move_only_constructed;}
};
int main()
{
{
std::allocator<A> a;
assert(new_called == 0);
assert(A_constructed == 0);
A* ap = a.allocate(3);
assert(new_called == 1);
assert(A_constructed == 0);
a.construct(ap);
assert(new_called == 1);
assert(A_constructed == 1);
a.destroy(ap);
assert(new_called == 1);
assert(A_constructed == 0);
a.construct(a
p, A());
assert(new_called == 1);
assert(A_constructed == 1);
a.destroy(ap);
assert(new_called == 1);
assert(A_constructed == 0);
a.construct(ap, 5);
assert(new_called == 1);
assert(A_constructed == 1);
a.destroy(ap);
assert(new_called == 1);
assert(A_constructed == 0);
a.construct(ap, 5, (int*)0);
assert(new_called == 1);
assert(A_constructed == 1);
a.destroy(ap);
assert(new_called == 1);
assert(A_constructed == 0);
a.deallocate(ap, 3);
assert(new_called == 0);
assert(A_constructed == 0);
}
{
std::allocator<move_only> a;
assert(new_called == 0);
assert(move_only_constructed == 0);
move_only* ap = a.allocate(3);
assert(new_called == 1);
assert(move_only_constructed == 0);
a.construct(ap);
assert(new_called == 1);
assert(move_only_constructed == 1);
a.destroy(ap);
assert(new_called == 1);
assert(move_only_constructed == 0);
a.co
nstruct(ap, move_only());
assert(new_called == 1);
assert(move_only_constructed == 1);
a.destroy(ap);
assert(new_called == 1);
assert(move_only_constructed == 0);
a.deallocate(ap, 3);
assert(new_called == 0);
assert(move_only_constructed == 0);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// allocator:
// template <class... Args> void construct(pointer p, Args&&... args);
#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>
int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
assert(s == 3 * sizeof(int));
return std::malloc(s);
}
void operator delete(void* p) throw()
{
--new_called;
std::free(p);
}
int A_constructed = 0;
struct A
{
int data;
A() {++A_constructed;}
A(const A&) {++A_constructed;}
explicit A(int) {++A_constructed;}
A(int, int*) {++A_constructed;}
~A() {--A_constructed;}
};
int move_only_
constructed = 0;
class move_only
{
int data;
#ifdef _LIBCPP_MOVE
move_only(const move_only&);
move_only& operator=(const move_only&);
#else
move_only(move_only&);
move_only& operator=(move_only&);
#endif
public:
#ifdef _LIBCPP_MOVE
move_only(move_only&&) {++move_only_constructed;}
move_only& operator=(move_only&&) {}
#else
operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
move_only(std::__rv<move_only>) {++move_only_constructed;}
#endif
move_only() {++move_only_constructed;}
~move_only() {--move_only_constructed;}
};
int main()
{
{
std::allocator<A> a;
assert(new_called == 0);
assert(A_constructed == 0);
A* ap = a.allocate(3);
assert(new_called == 1);
assert(A_constructed == 0);
a.construct(ap);
assert(new_called == 1);
assert(A_constructed == 1);
a.destroy(ap);
assert(new_called == 1);
assert(A_constructed == 0);
a.construct(ap, A());
assert(
new_called == 1);
assert(A_constructed == 1);
a.destroy(ap);
assert(new_called == 1);
assert(A_constructed == 0);
a.construct(ap, 5);
assert(new_called == 1);
assert(A_constructed == 1);
a.destroy(ap);
assert(new_called == 1);
assert(A_constructed == 0);
a.construct(ap, 5, (int*)0);
assert(new_called == 1);
assert(A_constructed == 1);
a.destroy(ap);
assert(new_called == 1);
assert(A_constructed == 0);
a.deallocate(ap, 3);
assert(new_called == 0);
assert(A_constructed == 0);
}
{
std::allocator<move_only> a;
assert(new_called == 0);
assert(move_only_constructed == 0);
move_only* ap = a.allocate(3);
assert(new_called == 1);
assert(move_only_constructed == 0);
a.construct(ap);
assert(new_called == 1);
assert(move_only_constructed == 1);
a.destroy(ap);
assert(new_called == 1);
assert(move_only_constructed == 0);
a.construct(ap, move_onl
y());
assert(new_called == 1);
assert(move_only_constructed == 1);
a.destroy(ap);
assert(new_called == 1);
assert(move_only_constructed == 0);
a.deallocate(ap, 3);
assert(new_called == 0);
assert(move_only_constructed == 0);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// allocator:
// size_type max_size() const throw();
#include <memory>
#include <limits>
#include <cstddef>
#include <cassert>
int new_called = 0;
int main()
{
const std::allocator<int> a;
std::size_t M = a.max_size() * sizeof(int);
assert(M > 0xFFFF && M <= std::numeric_limits<std::size_t>::max());
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// allocator:
// size_type max_size() const throw();
#include <memory>
#include <limits>
#include <cstddef>
#include <cassert>
int new_called = 0;
int main()
{
const std::allocator<int> a;
std::size_t M = a.max_size() * sizeof(int);
assert(M > 0xFFFF && M <= std::numeric_limits<std::size_t>::max());
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator_types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator_types.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator_types.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator_types.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// check nested types:
// template <class T>
// class allocator
// {
// public:
// typedef size_t size_type;
// typedef ptrdiff_t difference_type;
// typedef T* pointer;
// typedef const T* const_pointer;
// typedef typename add_lvalue_reference<T>::type reference;
// typedef typename add_lvalue_reference<const T>::type const_reference;
// typedef T value_type;
//
// template <class U> struct rebind {typedef all
ocator<U> other;};
// ...
// };
#include <memory>
#include <type_traits>
#include <cstddef>
int main()
{
static_assert((std::is_same<std::allocator<char>::size_type, std::size_t>::value), "");
static_assert((std::is_same<std::allocator<char>::difference_type, std::ptrdiff_t>::value), "");
static_assert((std::is_same<std::allocator<char>::pointer, char*>::value), "");
static_assert((std::is_same<std::allocator<char>::const_pointer, const char*>::value), "");
static_assert((std::is_same<std::allocator<char>::value_type, char>::value), "");
static_assert((std::is_same<std::allocator<char>::reference, char&>::value), "");
static_assert((std::is_same<std::allocator<char>::const_reference, const char&>::value), "");
static_assert((std::is_same<std::allocator<char>::rebind<int>::other,
std::allocator<int> >::value), "");
std::allocator<char> a;
std::allocator<char> a2 = a;
a2 = a;
std::allocator<int>
a3 = a2;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// check nested types:
// template <class T>
// class allocator
// {
// public:
// typedef size_t size_type;
// typedef ptrdiff_t difference_type;
// typedef T* pointer;
// typedef const T* const_pointer;
// typedef typename add_lvalue_reference<T>::type reference;
// typedef typename add_lvalue_reference<const T>::type const_reference;
// typedef T value_type;
//
// template <class U> struct rebind {typedef allocator<U> other;};
/
/ ...
// };
#include <memory>
#include <type_traits>
#include <cstddef>
int main()
{
static_assert((std::is_same<std::allocator<char>::size_type, std::size_t>::value), "");
static_assert((std::is_same<std::allocator<char>::difference_type, std::ptrdiff_t>::value), "");
static_assert((std::is_same<std::allocator<char>::pointer, char*>::value), "");
static_assert((std::is_same<std::allocator<char>::const_pointer, const char*>::value), "");
static_assert((std::is_same<std::allocator<char>::value_type, char>::value), "");
static_assert((std::is_same<std::allocator<char>::reference, char&>::value), "");
static_assert((std::is_same<std::allocator<char>::const_reference, const char&>::value), "");
static_assert((std::is_same<std::allocator<char>::rebind<int>::other,
std::allocator<int> >::value), "");
std::allocator<char> a;
std::allocator<char> a2 = a;
a2 = a;
std::allocator<int> a3 = a2;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator_void.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator_void.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator_void.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator_void.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <>
// class allocator<void>
// {
// public:
// typedef void* pointer;
// typedef const void* const_pointer;
// typedef void value_type;
//
// template <class _Up> struct rebind {typedef allocator<_Up> other;};
// };
#include <memory>
#include <type_traits>
int main()
{
static_assert((std::is_same<std::allocator<void>::pointer, void*>::value), "");
static_assert((std::is_same<std::allocator<void>::const_pointer, const void*>::value), "");
static_assert((std::is_same<std::alloc
ator<void>::value_type, void>::value), "");
static_assert((std::is_same<std::allocator<void>::rebind<int>::other,
std::allocator<int> >::value), "");
std::allocator<void> a;
std::allocator<void> a2 = a;
a2 = a;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <>
// class allocator<void>
// {
// public:
// typedef void* pointer;
// typedef const void* const_pointer;
// typedef void value_type;
//
// template <class _Up> struct rebind {typedef allocator<_Up> other;};
// };
#include <memory>
#include <type_traits>
int main()
{
static_assert((std::is_same<std::allocator<void>::pointer, void*>::value), "");
static_assert((std::is_same<std::allocator<void>::const_pointer, const void*>::value), "");
static_assert((std::is_same<std::allocator<void>::value_ty
pe, void>::value), "");
static_assert((std::is_same<std::allocator<void>::rebind<int>::other,
std::allocator<int> >::value), "");
std::allocator<void> a;
std::allocator<void> a2 = a;
a2 = a;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/pointer.traits/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/difference_type.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/difference_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/difference_type.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T>
// struct pointer_traits<T*>
// {
// typedef ptrdiff_t difference_type;
// ...
// };
#include <memory>
#include <type_traits>
int main()
{
static_assert((std::is_same<std::pointer_traits<double*>::difference_type, std::ptrdiff_t>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T>
// struct pointer_traits<T*>
// {
// typedef ptrdiff_t difference_type;
// ...
// };
#include <memory>
#include <type_traits>
int main()
{
static_assert((std::is_same<std::pointer_traits<double*>::difference_type, std::ptrdiff_t>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/pointer.traits/element_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/element_type.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/element_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/element_type.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T>
// struct pointer_traits<T*>
// {
// typedef T element_type;
// ...
// };
#include <memory>
#include <type_traits>
int main()
{
static_assert((std::is_same<std::pointer_traits<const short*>::element_type, const short>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T>
// struct pointer_traits<T*>
// {
// typedef T element_type;
// ...
// };
#include <memory>
#include <type_traits>
int main()
{
static_assert((std::is_same<std::pointer_traits<const short*>::element_type, const short>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/pointer.traits/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/pointer.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/pointer.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Ptr>
// struct pointer_traits
// {
// typedef Ptr pointer;
// ...
// };
#include <memory>
#include <type_traits>
struct A
{
typedef short element_type;
typedef char difference_type;
};
int main()
{
static_assert((std::is_same<std::pointer_traits<A>::pointer, A>::value), "");
static_assert((std::is_same<std::pointer_traits<int*>::pointer, int*>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Ptr>
// struct pointer_traits
// {
// typedef Ptr pointer;
// ...
// };
#include <memory>
#include <type_traits>
struct A
{
typedef short element_type;
typedef char difference_type;
};
int main()
{
static_assert((std::is_same<std::pointer_traits<A>::pointer, A>::value), "");
static_assert((std::is_same<std::pointer_traits<int*>::pointer, int*>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Ptr>
// struct pointer_traits
// {
// static pointer pointer_to(<details>);
// ...
// };
#include <memory>
#include <cassert>
template <class T>
struct A
{
private:
struct nat {};
public:
typedef T element_type;
element_type* t_;
A(element_type* t) : t_(t) {}
static A pointer_to(typename std::conditional<std::is_void<element_type>::value,
nat, element_type>::type& et)
{return A(&et);}
};
int main()
{
{
int i = 0;
A<int> a = std::pointer_traits<A<int> >::pointer_to(i);
assert(a.t
_ = &i);
}
{
(std::pointer_traits<A<void> >::element_type)0;
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Ptr>
// struct pointer_traits
// {
// static pointer pointer_to(<details>);
// ...
// };
#include <memory>
#include <cassert>
template <class T>
struct A
{
private:
struct nat {};
public:
typedef T element_type;
element_type* t_;
A(element_type* t) : t_(t) {}
static A pointer_to(typename std::conditional<std::is_void<element_type>::value,
nat, element_type>::type& et)
{return A(&et);}
};
int main()
{
{
int i = 0;
A<int> a = std::pointer_traits<A<int> >::pointer_to(i);
assert(a.t_ = &i);
}
{
(std::pointer_traits<A<void> >::element_type)0;
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Ptr>
// struct pointer_traits
// {
// typedef <details> difference_type;
// ...
// };
#include <memory>
#include <type_traits>
struct A
{
typedef short element_type;
typedef char difference_type;
};
struct B
{
typedef short element_type;
};
template <class T>
struct C {};
template <class T>
struct D
{
typedef char difference_type;
};
int main()
{
static_assert((std::is_same<std::pointer_traits<A>::difference_type, char>::value), "");
static_assert((std::is_same<std::pointer_traits<B>::difference_type, std::ptrdiff_t>::value), "");
static_assert((s
td::is_same<std::pointer_traits<C<double> >::difference_type, std::ptrdiff_t>::value), "");
static_assert((std::is_same<std::pointer_traits<D<int> >::difference_type, char>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Ptr>
// struct pointer_traits
// {
// typedef <details> difference_type;
// ...
// };
#include <memory>
#include <type_traits>
struct A
{
typedef short element_type;
typedef char difference_type;
};
struct B
{
typedef short element_type;
};
template <class T>
struct C {};
template <class T>
struct D
{
typedef char difference_type;
};
int main()
{
static_assert((std::is_same<std::pointer_traits<A>::difference_type, char>::value), "");
static_assert((std::is_same<std::pointer_traits<B>::difference_type, std::ptrdiff_t>::value), "");
static_assert((std::is_same<std::poi
nter_traits<C<double> >::difference_type, std::ptrdiff_t>::value), "");
static_assert((std::is_same<std::pointer_traits<D<int> >::difference_type, char>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Ptr>
// struct pointer_traits
// {
// typedef <details> element_type;
// ...
// };
#include <memory>
#include <type_traits>
struct A
{
typedef char element_type;
};
template <class T>
struct B
{
typedef char element_type;
};
template <class T>
struct C
{
};
template <class T, class U>
struct D
{
};
int main()
{
static_assert((std::is_same<std::pointer_traits<A>::element_type, char>::value), "");
static_assert((std::is_same<std::pointer_traits<B<int> >::element_type, char>::value), "");
static_assert((std::is_same<std::pointer_traits<C<int> >::element_type
, int>::value), "");
static_assert((std::is_same<std::pointer_traits<D<double, int> >::element_type, double>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Ptr>
// struct pointer_traits
// {
// typedef <details> element_type;
// ...
// };
#include <memory>
#include <type_traits>
struct A
{
typedef char element_type;
};
template <class T>
struct B
{
typedef char element_type;
};
template <class T>
struct C
{
};
template <class T, class U>
struct D
{
};
int main()
{
static_assert((std::is_same<std::pointer_traits<A>::element_type, char>::value), "");
static_assert((std::is_same<std::pointer_traits<B<int> >::element_type, char>::value), "");
static_assert((std::is_same<std::pointer_traits<C<int> >::element_type, int>::value), "");
static_assert((std::is_same<std::pointer_traits<D<double, int> >::element_type, double>::value), "");
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Ptr>
// struct pointer_traits
// {
// template <class U> using rebind = <details>;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
};
template <class T> struct B1 {};
template <class T>
struct B
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class U> using rebind = B1<U>;
#else
template <class U> struct rebind {typedef B1<U> other;};
#endif
};
template <class T, class U>
struct C
{
};
template <class T, class U> struct D1 {};
template <class T, class U>
struct D
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class V>
using rebind = D1<V, U>;
#else
template <class V> struct rebind {typedef D1<V, U> other;};
#endif
};
int main()
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>, A<double*> >::value), "");
static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>, B1<double> >::value), "");
static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>, C<double, int> >::value), "");
static_assert((std::is_same<std::pointer_traits<D<char, int> >::rebind<double>, D1<double, int> >::value), "");
#else
static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>::other, A<double*> >::value), "");
static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>::other, B1<double> >::value), "");
static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>::other, C<double, int> >::value), "");
static_assert((std::is_same<
std::pointer_traits<D<char, int> >::rebind<double>::other, D1<double, int> >::value), "");
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class Ptr>
// struct pointer_traits
// {
// template <class U> using rebind = <details>;
// ...
// };
#include <memory>
#include <type_traits>
template <class T>
struct A
{
};
template <class T> struct B1 {};
template <class T>
struct B
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class U> using rebind = B1<U>;
#else
template <class U> struct rebind {typedef B1<U> other;};
#endif
};
template <class T, class U>
struct C
{
};
template <class T, class U> struct D1 {};
template <class T, class U>
struct D
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class V> using rebind = D1<V
, U>;
#else
template <class V> struct rebind {typedef D1<V, U> other;};
#endif
};
int main()
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>, A<double*> >::value), "");
static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>, B1<double> >::value), "");
static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>, C<double, int> >::value), "");
static_assert((std::is_same<std::pointer_traits<D<char, int> >::rebind<double>, D1<double, int> >::value), "");
#else
static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>::other, A<double*> >::value), "");
static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>::other, B1<double> >::value), "");
static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>::other, C<double, int> >::value), "");
static_assert((std::is_same<std::pointer_traits<
D<char, int> >::rebind<double>::other, D1<double, int> >::value), "");
#endif
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/pointer.traits/pointer_to.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/pointer_to.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/pointer_to.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/pointer_to.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T>
// struct pointer_traits<T*>
// {
// static pointer pointer_to(<details>);
// ...
// };
#include <memory>
#include <cassert>
int main()
{
{
int i = 0;
int* a = std::pointer_traits<int*>::pointer_to(i);
assert(a = &i);
}
{
(std::pointer_traits<void*>::element_type)0;
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T>
// struct pointer_traits<T*>
// {
// static pointer pointer_to(<details>);
// ...
// };
#include <memory>
#include <cassert>
int main()
{
{
int i = 0;
int* a = std::pointer_traits<int*>::pointer_to(i);
assert(a = &i);
}
{
(std::pointer_traits<void*>::element_type)0;
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/pointer.traits/rebind.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/rebind.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/rebind.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/rebind.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T>
// struct pointer_traits<T*>
// {
// template <class U> using rebind = U*;
// ...
// };
#include <memory>
#include <type_traits>
int main()
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>, double*>::value), "");
#else
static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>::other, double*>::value), "");
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T>
// struct pointer_traits<T*>
// {
// template <class U> using rebind = U*;
// ...
// };
#include <memory>
#include <type_traits>
int main()
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>, double*>::value), "");
#else
static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>::other, double*>::value), "");
#endif
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/ptr.align/align.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/ptr.align/align.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/ptr.align/align.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/ptr.align/align.pass.cpp Tue May 11 16:36:01 2010
@@ -1,6 +1,6 @@
//===----------------------------------------------------------------------===//
//
-// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
Modified: libcxx/trunk/test/utilities/memory/specialized.algorithms/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/specialized.algorithms/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/specialized.algorithms/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/specialized.algorithms/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <ObjectType T> T* addressof(T& r);
#include <memory>
#include <cassert>
struct A
{
void operator&() const {}
};
int main()
{
int i;
double d;
assert(std::addressof(i) == &i);
assert(std::addressof(d) == &d);
A* tp = new A;
const A* ctp = tp;
assert(std::addressof(*tp) == tp);
assert(std::addressof(*ctp) == tp);
delete tp;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <ObjectType T> T* addressof(T& r);
#include <memory>
#include <cassert>
struct A
{
void operator&() const {}
};
int main()
{
int i;
double d;
assert(std::addressof(i) == &i);
assert(std::addressof(d) == &d);
A* tp = new A;
const A* ctp = tp;
assert(std::addressof(*tp) == tp);
assert(std::addressof(*ctp) == tp);
delete tp;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class InputIterator, class ForwardIterator>
// ForwardIterator
// uninitialized_copy(InputIterator first, InputIterator last,
// ForwardIterator result);
#include <memory>
#include <cassert>
struct B
{
static int count_;
int data_;
explicit B() : data_(1) {}
B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
~B() {data_ = 0;}
};
int B::count_ = 0;
int main()
{
const int N = 5;
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
B b[N];
try
{
std::uninitialized_copy(b, b+N, bp);
assert(false);
}
catch (...)
{
for (int i = 0; i < N; ++i)
assert(bp[i].data_ == 0);
}
B::count_ = 0;
std::uninitialized_copy(b, b+2, bp);
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class InputIterator, class ForwardIterator>
// ForwardIterator
// uninitialized_copy(InputIterator first, InputIterator last,
// ForwardIterator result);
#include <memory>
#include <cassert>
struct B
{
static int count_;
int data_;
explicit B() : data_(1) {}
B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
~B() {data_ = 0;}
};
int B::count_ = 0;
int main()
{
const int N = 5;
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
B b[N];
try
{
std::uninitialized_copy(b, b+N, bp);
assert(false);
}
catch (...)
{
for (int i = 0; i < N; ++i)
assert(bp[i].data_ == 0);
}
B::count_ = 0;
std::uninitialized_copy(b, b+2, bp);
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class InputIterator, class Size, class ForwardIterator>
// ForwardIterator
// uninitialized_copy_n(InputIterator first, Size n,
// ForwardIterator result);
#include <memory>
#include <cassert>
struct B
{
static int count_;
int data_;
explicit B() : data_(1) {}
B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
~B() {data_ = 0;}
};
int B::count_ = 0;
int main()
{
const int N = 5;
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
B b[N];
try
{
std::uninitialized_copy_n(b, 5, bp);
assert(false);
}
catch (...)
{
for (int i = 0; i < N; ++i)
assert(bp[i].data_ == 0);
}
B::count_ = 0;
std::uninitialized_copy_n(b, 2, bp);
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class InputIterator, class Size, class ForwardIterator>
// ForwardIterator
// uninitialized_copy_n(InputIterator first, Size n,
// ForwardIterator result);
#include <memory>
#include <cassert>
struct B
{
static int count_;
int data_;
explicit B() : data_(1) {}
B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
~B() {data_ = 0;}
};
int B::count_ = 0;
int main()
{
const int N = 5;
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
B b[N];
try
{
std::uninitialized_copy_n(b, 5, bp);
assert(false);
}
catch (...)
{
for (int i = 0; i < N; ++i)
assert(bp[i].data_ == 0);
}
B::count_ = 0;
std::uninitialized_copy_n(b, 2, bp);
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class ForwardIterator, class Size, class T>
// void
// uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
#include <memory>
#include <cassert>
struct B
{
static int count_;
int data_;
explicit B() : data_(1) {}
B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
~B() {data_ = 0;}
};
int B::count_ = 0;
int main()
{
const int N = 5;
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
try
{
std::uninitialized_fill_n(bp, 5, B());
assert(false);
}
catch (...)
{
for (int i = 0; i < N; ++i)
assert(bp[i].data_ == 0);
}
B::count_ = 0;
std::uninitialized_fill_n(bp, 2, B());
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class ForwardIterator, class Size, class T>
// void
// uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
#include <memory>
#include <cassert>
struct B
{
static int count_;
int data_;
explicit B() : data_(1) {}
B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
~B() {data_ = 0;}
};
int B::count_ = 0;
int main()
{
const int N = 5;
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
try
{
std::uninitialized_fill_n(bp, 5, B());
assert(false);
}
catch (...)
{
for (int i = 0; i < N; ++i)
assert(bp[i].dat
a_ == 0);
}
B::count_ = 0;
std::uninitialized_fill_n(bp, 2, B());
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class ForwardIterator, class T>
// void
// uninitialized_fill(ForwardIterator first, ForwardIterator last,
// const T& x);
#include <memory>
#include <cassert>
struct B
{
static int count_;
int data_;
explicit B() : data_(1) {}
B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
~B() {data_ = 0;}
};
int B::count_ = 0;
int main()
{
const int N = 5;
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
try
{
std::uninitialized_fill(bp, bp+N, B());
assert(false);
}
catch (...)
{
for (int i
= 0; i < N; ++i)
assert(bp[i].data_ == 0);
}
B::count_ = 0;
std::uninitialized_fill(bp, bp+2, B());
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class ForwardIterator, class T>
// void
// uninitialized_fill(ForwardIterator first, ForwardIterator last,
// const T& x);
#include <memory>
#include <cassert>
struct B
{
static int count_;
int data_;
explicit B() : data_(1) {}
B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
~B() {data_ = 0;}
};
int B::count_ = 0;
int main()
{
const int N = 5;
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
try
{
std::uninitialized_fill(bp, bp+N, B());
assert(false);
}
catch (...)
{
for (int i = 0; i < N; ++i)
assert(bp[i].data_ == 0);
}
B::count_ = 0;
std::uninitialized_fill(bp, bp+2, B());
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// raw_storage_iterator
#include <memory>
#include <type_traits>
#include <cassert>
int A_constructed = 0;
struct A
{
int data_;
public:
explicit A(int i) : data_(i) {++A_constructed;}
A(const A& a) : data_(a.data_) {++A_constructed;}
~A() {--A_constructed; data_ = 0;}
bool operator==(int i) const {return data_ == i;}
};
int main()
{
typedef std::aligned_storage<3*sizeof(A), std::alignment_of<A>::value>::type
Storage;
Storage buffer;
std::raw_storage_iterator<A*, A> it((A*)&buffer);
assert(A_constructed == 0);
for (int i = 0; i < 3; ++i)
{
*it++ = A(
i+1);
A* ap = (A*)&buffer + i;
assert(*ap == i+1);
assert(A_constructed == i+1);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// raw_storage_iterator
#include <memory>
#include <type_traits>
#include <cassert>
int A_constructed = 0;
struct A
{
int data_;
public:
explicit A(int i) : data_(i) {++A_constructed;}
A(const A& a) : data_(a.data_) {++A_constructed;}
~A() {--A_constructed; data_ = 0;}
bool operator==(int i) const {return data_ == i;}
};
int main()
{
typedef std::aligned_storage<3*sizeof(A), std::alignment_of<A>::value>::type
Storage;
Storage buffer;
std::raw_storage_iterator<A*, A> it((A*)&buffer);
assert(A_constructed == 0);
for (int i = 0; i < 3; ++i)
{
*it++ = A(i+1);
A* ap
= (A*)&buffer + i;
assert(*ap == i+1);
assert(A_constructed == i+1);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T>
// pair<T*, ptrdiff_t>
// get_temporary_buffer(ptrdiff_t n);
//
// template <class T>
// void
// return_temporary_buffer(T* p);
#include <memory>
#include <cassert>
int main()
{
std::pair<int*, std::ptrdiff_t> ip = std::get_temporary_buffer<int>(5);
assert(ip.first);
assert(ip.second == 5);
std::return_temporary_buffer(ip.first);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template <class T>
// pair<T*, ptrdiff_t>
// get_temporary_buffer(ptrdiff_t n);
//
// template <class T>
// void
// return_temporary_buffer(T* p);
#include <memory>
#include <cassert>
int main()
{
std::pair<int*, std::ptrdiff_t> ip = std::get_temporary_buffer<int>(5);
assert(ip.first);
assert(ip.second == 5);
std::return_temporary_buffer(ip.first);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/deleter.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/deleter.h?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/deleter.h (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/deleter.h Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Example move-only deleter
#ifndef DELETER_H
#define DELETER_H
#include <type_traits>
#include <cassert>
template <class T>
class Deleter
{
int state_;
#ifdef _LIBCPP_MOVE
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
#else
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif
public:
#ifdef _LIBCPP_MOVE
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
state_ = r.state_;
r.state_ = 0;
return *this;
}
#else
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*th
is);}
Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif
Deleter() : state_(0) {}
explicit Deleter(int s) : state_(s) {}
~Deleter() {assert(state_ >= 0); state_ = -1;}
#ifdef _LIBCPP_MOVE
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {d.set_state(0);}
private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
template <class U>
Deleter(Deleter<U> d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {}
#endif
public:
int state() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* p) {delete p;}
};
template <class T>
class Deleter<T[]>
{
int state_;
#ifdef _LIBCPP_MOVE
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
#else
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif
public:
#ifdef _LIBCPP_MOVE
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
state_ = r.state_;
r.state_ = 0;
return *this;
}
#else
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif
Deleter() : state_(0) {}
explicit Deleter(int s) : state_(s) {}
~Deleter() {assert(state_ >= 0); state_ = -1;}
int state() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* p) {delete [] p;}
};
template <class T>
void
sw
ap(Deleter<T>& x, Deleter<T>& y)
{
Deleter<T> t(std::move(x));
x = std::move(y);
y = std::move(t);
}
template <class T>
class CDeleter
{
int state_;
public:
CDeleter() : state_(0) {}
explicit CDeleter(int s) : state_(s) {}
~CDeleter() {assert(state_ >= 0); state_ = -1;}
template <class U>
CDeleter(const CDeleter<U>& d)
: state_(d.state()) {}
int state() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* p) {delete p;}
};
template <class T>
class CDeleter<T[]>
{
int state_;
public:
CDeleter() : state_(0) {}
explicit CDeleter(int s) : state_(s) {}
~CDeleter() {assert(state_ >= 0); state_ = -1;}
int state() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* p) {delete [] p;}
};
template <class T>
void
swap(CDeleter<T>& x, CDeleter<T>& y)
{
CDeleter<T> t(std::move(x));
x = std::move(y);
y = std::move(t);
}
#end
if
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Example move-only deleter
#ifndef DELETER_H
#define DELETER_H
#include <type_traits>
#include <cassert>
template <class T>
class Deleter
{
int state_;
#ifdef _LIBCPP_MOVE
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
#else
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif
public:
#ifdef _LIBCPP_MOVE
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
state_ = r.state_;
r.state_ = 0;
return *this;
}
#else
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
Deleter(st
d::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif
Deleter() : state_(0) {}
explicit Deleter(int s) : state_(s) {}
~Deleter() {assert(state_ >= 0); state_ = -1;}
#ifdef _LIBCPP_MOVE
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {d.set_state(0);}
private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
template <class U>
Deleter(Deleter<U> d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {}
#endif
public:
int state() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* p) {delete p;}
};
template <class
T>
class Deleter<T[]>
{
int state_;
#ifdef _LIBCPP_MOVE
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
#else
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif
public:
#ifdef _LIBCPP_MOVE
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
state_ = r.state_;
r.state_ = 0;
return *this;
}
#else
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif
Deleter() : state_(0) {}
explicit Deleter(int s) : state_(s) {}
~Deleter() {assert(state_ >= 0); state_ = -1;}
int state() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* p) {delete [] p;}
};
template <class T>
void
swap(Deleter<T>& x, De
leter<T>& y)
{
Deleter<T> t(std::move(x));
x = std::move(y);
y = std::move(t);
}
template <class T>
class CDeleter
{
int state_;
public:
CDeleter() : state_(0) {}
explicit CDeleter(int s) : state_(s) {}
~CDeleter() {assert(state_ >= 0); state_ = -1;}
template <class U>
CDeleter(const CDeleter<U>& d)
: state_(d.state()) {}
int state() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* p) {delete p;}
};
template <class T>
class CDeleter<T[]>
{
int state_;
public:
CDeleter() : state_(0) {}
explicit CDeleter(int s) : state_(s) {}
~CDeleter() {assert(state_ >= 0); state_ = -1;}
int state() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* p) {delete [] p;}
};
template <class T>
void
swap(CDeleter<T>& x, CDeleter<T>& y)
{
CDeleter<T> t(std::move(x));
x = std::move(y);
y = std::move(t);
}
#endif
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// default_delete
#include <memory>
#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()
{
std::default_delete<B> d2;
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// default_delete
#include <memory>
#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()
{
std::default_delete<B> d2;
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// default_delete
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
std::default_delete<A> d;
A* p = new A;
assert(A::count == 1);
d(p);
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// default_delete
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
std::default_delete<A> d;
A* p = new A;
assert(A::count == 1);
d(p);
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// default_delete
// Test that default_delete's operator() requires a complete type
#include <memory>
#include <cassert>
struct A;
int main()
{
std::default_delete<A> d;
A* p = 0;
d(p);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// default_delete
// Test that default_delete's operator() requires a complete type
#include <memory>
#include <cassert>
struct A;
int main()
{
std::default_delete<A> d;
A* p = 0;
d(p);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// default_delete
// Test that default_delete<T[]> does not have a working converting constructor
#include <memory>
#include <cassert>
struct A
{
};
struct B
: public A
{
};
int main()
{
std::default_delete<B[]> d2;
std::default_delete<A[]> d1 = d2;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// default_delete
// Test that default_delete<T[]> does not have a working converting constructor
#include <memory>
#include <cassert>
struct A
{
};
struct B
: public A
{
};
int main()
{
std::default_delete<B[]> d2;
std::default_delete<A[]> d1 = d2;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// default_delete
// Test that default_delete<T[]> has a working default constructor
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
std::default_delete<A[]> d;
A* p = new A[3];
assert(A::count == 3);
d(p);
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// default_delete
// Test that default_delete<T[]> has a working default constructor
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
std::default_delete<A[]> d;
A* p = new A[3];
assert(A::count == 3);
d(p);
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// default_delete
// Test that default_delete<T[]>'s operator() requires a complete type
#include <memory>
#include <cassert>
struct A;
int main()
{
std::default_delete<A[]> d;
A* p = 0;
d(p);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// default_delete
// Test that default_delete<T[]>'s operator() requires a complete type
#include <memory>
#include <cassert>
struct A;
int main()
{
std::default_delete<A[]> d;
A* p = 0;
d(p);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
int main()
{
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A> s(new A);
std::unique_ptr<A> s2;
s2 = s;
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A> s(new A);
std::unique_ptr<A> s2;
s2 = s;
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
// test move assignment. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
#include <memory>
#include <cassert>
#include "../deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::unique_ptr<A[]> s1(new A[3]);
A* p = s1.get();
assert(A::count == 3);
std::unique_ptr<A[]> s2(new A[2]);
assert(A::count == 5);
s2 = std::move(s1);
assert(A::count == 3);
assert(s2.get() == p);
assert(s1.get() == 0);
}
assert(A::count == 0);
{
std::unique_ptr<A[], Deleter<A[]> > s1(new A[4], Deleter<A[]>(5));
A* p = s1.get();
assert(A::count == 4);
std::unique_ptr<A[], Deleter<A[]> > s2(new A[5]);
assert(A::count == 9);
s2 = std::move(s1);
assert(s2.get() == p);
assert(s1.get() == 0);
assert(A::count == 4);
assert(s2.get_deleter().state() == 5);
assert(s1.get_deleter().state() == 0);
}
assert(A::count == 0);
{
CDeleter<A[]> d1(5);
std::unique_ptr<A[], CDeleter<A[]>&> s1(new A[6], d1);
A* p = s1.get();
assert(A::count == 6);
CDeleter<A[]> d2(6);
std::unique_ptr<A[], CDeleter<A[]>&> s2(new A[3], d2);
assert(A::count == 9);
s2 = std::move(s1);
assert(A::count == 6);
assert(s2.get() == p);
assert(s1.get() == 0);
assert(d1.state() == 5);
assert(d2.state() == 5);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
// test move assignment. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
#include <memory>
#include <cassert>
#include "../deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::unique_ptr<A[]> s1(new A[3]);
A* p = s1.get();
assert(A::count == 3);
std::unique_ptr<A[]> s2(new A[2]);
assert(A::count == 5);
s2 = std::move(s1);
assert(A::count == 3);
assert(s2.get() == p);
assert(s1.get() =
= 0);
}
assert(A::count == 0);
{
std::unique_ptr<A[], Deleter<A[]> > s1(new A[4], Deleter<A[]>(5));
A* p = s1.get();
assert(A::count == 4);
std::unique_ptr<A[], Deleter<A[]> > s2(new A[5]);
assert(A::count == 9);
s2 = std::move(s1);
assert(s2.get() == p);
assert(s1.get() == 0);
assert(A::count == 4);
assert(s2.get_deleter().state() == 5);
assert(s1.get_deleter().state() == 0);
}
assert(A::count == 0);
{
CDeleter<A[]> d1(5);
std::unique_ptr<A[], CDeleter<A[]>&> s1(new A[6], d1);
A* p = s1.get();
assert(A::count == 6);
CDeleter<A[]> d2(6);
std::unique_ptr<A[], CDeleter<A[]>&> s2(new A[3], d2);
assert(A::count == 9);
s2 = std::move(s1);
assert(A::count == 6);
assert(s2.get() == p);
assert(s1.get() == 0);
assert(d1.state() == 5);
assert(d2.state() == 5);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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 std::unique_ptr<A[]> s(new A[3]);
std::unique_ptr<A[]> s2;
s2 = s;
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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 std::unique_ptr<A[]> s(new A[3]);
std::unique_ptr<A[]> s2;
s2 = s;
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A, Deleter> s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter> s2;
s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
ass
ert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A, Deleter> s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter> s2;
s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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 std::unique_ptr<A, Deleter> s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter> s2;
s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::cou
nt == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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 std::unique_ptr<A, Deleter> s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter> s2;
s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#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()
{
{
std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::unique_ptr<A[]> s2;
s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
assert(B::c
ount == 1);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#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()
{
{
std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from lvalue
#include <memory>
#include <cassert>
#include "../deleter.h"
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[], 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from lvalue
#include <memory>
#include <cassert>
#include "../deleter.h"
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[], 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);
ass
ert(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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from lvalue
#include <memory>
#include <cassert>
#include "../deleter.h"
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()
{
{
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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from lvalue
#include <memory>
#include <cassert>
#include "../deleter.h"
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()
{
{
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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from const lvalue
#include <memory>
#include <cassert>
#include "../deleter.h"
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[], 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from const lvalue
#include <memory>
#include <cassert>
#include "../deleter.h"
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[], 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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from const lvalue
#include <memory>
#include <cassert>
#include "../deleter.h"
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()
{
{
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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from const lvalue
#include <memory>
#include <cassert>
#include "../deleter.h"
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()
{
{
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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#include <cassert>
#include "../deleter.h"
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[], 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#include <cassert>
#include "../deleter.h"
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[], 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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// test converting move assignment with reference deleters
#include <memory>
#include <cassert>
#include "../deleter.h"
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()
{
{
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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// test converting move assignment with reference deleters
#include <memory>
#include <cassert>
#include "../deleter.h"
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()
{
{
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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A> s2(new A);
assert(A::count == 1);
s2 = 0;
assert(A::count == 0);
assert(s2.get() == 0);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A> s2(new A);
assert(A::count == 1);
s2 = 0;
assert(A::count == 0);
assert(s2.get() == 0);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// The deleter is not called if get() == 0
#include <memory>
#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);
{
std::unique_ptr<int[], Deleter&> p(0, d);
assert(p.get() == 0);
assert(&p.get_deleter() == &d);
}
assert(d.state() == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// The deleter is not called if get() == 0
#include <memory>
#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);
{
std::unique_ptr<int[], Deleter&> p(0, d);
assert(p.get() == 0);
assert(&p.get_deleter() == &d);
}
assert(d.state() == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A[]> s2(new A[3]);
assert(A::count == 3);
s2 = nullptr;
assert(A::count == 0);
assert(s2.get() == 0);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A[]> s2(new A[3]);
assert(A::count == 3);
s2 = nullptr;
assert(A::count == 0);
assert(s2.get() == 0);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr<T[]>::pointer type
#include <memory>
#include <type_traits>
struct Deleter
{
struct pointer {};
};
int main()
{
{
typedef std::unique_ptr<int[]> P;
static_assert((std::is_same<P::pointer, int*>::value), "");
}
{
typedef std::unique_ptr<int[], Deleter> P;
static_assert((std::is_same<P::pointer, Deleter::pointer>::value), "");
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr<T[]>::pointer type
#include <memory>
#include <type_traits>
struct Deleter
{
struct pointer {};
};
int main()
{
{
typedef std::unique_ptr<int[]> P;
static_assert((std::is_same<P::pointer, int*>::value), "");
}
{
typedef std::unique_ptr<int[], Deleter> P;
static_assert((std::is_same<P::pointer, Deleter::pointer>::value), "");
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
// default unique_ptr ctor should require default Deleter ctor
#include <memory>
class Deleter
{
Deleter() {}
public:
Deleter(Deleter&) {}
Deleter& operator=(Deleter&) {}
void operator()(void*) const {}
};
int main()
{
std::unique_ptr<int[], Deleter> p;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
// default unique_ptr ctor should require default Deleter ctor
#include <memory>
class Deleter
{
Deleter() {}
public:
Deleter(Deleter&) {}
Deleter& operator=(Deleter&) {}
void operator()(void*) const {}
};
int main()
{
std::unique_ptr<int[], Deleter> p;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
// default unique_ptr ctor should only require default Deleter ctor
#include <memory>
#include <cassert>
class Deleter
{
int state_;
Deleter(Deleter&);
Deleter& operator=(Deleter&);
public:
Deleter() : state_(5) {}
int state() const {return state_;}
void operator()(void*) {}
};
int main()
{
{
std::unique_ptr<int[]> p;
assert(p.get() == 0);
}
{
std::unique_ptr<int[], Deleter> p;
assert(p.get() == 0);
assert(p.get_deleter().state() == 5);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
// default unique_ptr ctor should only require default Deleter ctor
#include <memory>
#include <cassert>
class Deleter
{
int state_;
Deleter(Deleter&);
Deleter& operator=(Deleter&);
public:
Deleter() : state_(5) {}
int state() const {return state_;}
void operator()(void*) {}
};
int main()
{
{
std::unique_ptr<int[]> p;
assert(p.get() == 0);
}
{
std::unique_ptr<int[], Deleter> p;
assert(p.get() == 0);
assert(p.get_deleter().state() == 5);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
// default unique_ptr ctor should require non-reference Deleter ctor
#include <memory>
class Deleter
{
public:
void operator()(void*) {}
};
int main()
{
std::unique_ptr<int[], Deleter&> p;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
// default unique_ptr ctor should require non-reference Deleter ctor
#include <memory>
class Deleter
{
public:
void operator()(void*) {}
};
int main()
{
std::unique_ptr<int[], Deleter&> p;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test default unique_ptr<T[]> ctor
// default unique_ptr<T[]> ctor shouldn't require complete type
#include <memory>
#include <cassert>
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 = std::default_delete<A> >
struct B
{
std::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() {}
template <class D>
B<D>::~B() {}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test default unique_ptr<T[]> ctor
// default unique_ptr<T[]> ctor shouldn't require complete type
#include <memory>
#include <cassert>
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 = std::default_delete<A> >
struct B
{
std::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() {}
template <class D>
B<D>::~B() {}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
// default unique_ptr ctor should require non-pointer Deleter
#include <memory>
int main()
{
std::unique_ptr<int[], void (*)(void*)> p;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
// default unique_ptr ctor should require non-pointer Deleter
#include <memory>
int main()
{
std::unique_ptr<int[], void (*)(void*)> p;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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()
{
{
std::unique_ptr<A[]> s(new A[3]);
A* p = s.get();
std::unique_ptr<A[]> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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()
{
{
std::unique_ptr<A[]> s(new A[3]);
A* p = s.get();
std::unique_ptr<A[]> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
// test move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
#include <memory>
#include <cassert>
#include "../../deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
class NCDeleter
{
int state_;
NCDeleter(NCDeleter&);
NCDeleter& operator=(NCDeleter&);
public:
NCDeleter() : state_(5) {}
int state() const {return state_;}
void set_state(int s) {state_ = s;}
void operator()(A* p) {delete [] p;
}
};
int main()
{
{
std::unique_ptr<A[]> s(new A[3]);
A* p = s.get();
std::unique_ptr<A[]> s2 = std::move(s);
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 3);
}
assert(A::count == 0);
{
std::unique_ptr<A[], Deleter<A[]> > s(new A[3], Deleter<A[]>(5));
A* p = s.get();
std::unique_ptr<A[], Deleter<A[]> > s2 = std::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);
{
NCDeleter d;
std::unique_ptr<A[], NCDeleter&> s(new A[3], d);
A* p = s.get();
std::unique_ptr<A[], NCDeleter&> s2 = std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
// test move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
#include <memory>
#include <cassert>
#include "../../deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
class NCDeleter
{
int state_;
NCDeleter(NCDeleter&);
NCDeleter& operator=(NCDeleter&);
public:
NCDeleter() : state_(5) {}
int state() const {return state_;}
void set_state(int s) {state_ = s;}
void operator()(A* p) {delete [] p;}
};
int main()
{
{
std::unique_ptr<A[]> s(new A[3]);
A* p = s.get();
std::unique_ptr<A[]> s2 = std::move(s);
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 3);
}
assert(A::count == 0);
{
std::unique_ptr<A[], Deleter<A[]> > s(new A[3], Deleter<A[]>(5));
A* p = s.get();
std::unique_ptr<A[], Deleter<A[]> > s2 = std::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);
{
NCDeleter d;
std::unique_ptr<A[], NCDeleter&> s(new A[3], d);
A* p = s.get();
std::unique_ptr<A[], NCDeleter&> s2 = std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
// test move ctor. Can't copy from const lvalue
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
const std::unique_ptr<A[]> s(new A[3]);
A* p = s.get();
std::unique_ptr<A[]> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
// test move ctor. Can't copy from const lvalue
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
const std::unique_ptr<A[]> s(new A[3]);
A* p = s.get();
std::unique_ptr<A[]> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
// test move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
#include <memory>
#include <cassert>
#include "../../deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
class NCDeleter
{
int state_;
NCDeleter(NCDeleter&);
NCDeleter& operator=(NCDeleter&);
public:
NCDeleter() : state_(5) {}
int state() const {return state_;}
void set_state(int s) {state_ = s;}
void operator()(A* p) {delete [] p;
}
};
std::unique_ptr<A[]>
source1()
{
return std::unique_ptr<A[]>(new A[3]);
}
void sink1(std::unique_ptr<A[]> p)
{
}
std::unique_ptr<A[], Deleter<A[]> >
source2()
{
return std::unique_ptr<A[], Deleter<A[]> >(new A[3]);
}
void sink2(std::unique_ptr<A[], Deleter<A[]> > p)
{
}
std::unique_ptr<A[], NCDeleter&>
source3()
{
static NCDeleter d;
return std::unique_ptr<A[], NCDeleter&>(new A[3], d);
}
void sink3(std::unique_ptr<A[], NCDeleter&> p)
{
}
int main()
{
sink1(source1());
sink2(source2());
sink3(source3());
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
// test move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
#include <memory>
#include <cassert>
#include "../../deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
class NCDeleter
{
int state_;
NCDeleter(NCDeleter&);
NCDeleter& operator=(NCDeleter&);
public:
NCDeleter() : state_(5) {}
int state() const {return state_;}
void set_state(int s) {state_ = s;}
void operator()(A* p) {delete [] p;}
};
std::unique_pt
r<A[]>
source1()
{
return std::unique_ptr<A[]>(new A[3]);
}
void sink1(std::unique_ptr<A[]> p)
{
}
std::unique_ptr<A[], Deleter<A[]> >
source2()
{
return std::unique_ptr<A[], Deleter<A[]> >(new A[3]);
}
void sink2(std::unique_ptr<A[], Deleter<A[]> > p)
{
}
std::unique_ptr<A[], NCDeleter&>
source3()
{
static NCDeleter d;
return std::unique_ptr<A[], NCDeleter&>(new A[3], d);
}
void sink3(std::unique_ptr<A[], NCDeleter&> p)
{
}
int main()
{
sink1(source1());
sink2(source2());
sink3(source3());
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
// test move ctor. Can't copy from lvalue
#include <memory>
#include <cassert>
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()
{
{
std::unique_ptr<A[], Deleter> s(new A[3]);
A* p = s.get();
std::unique_ptr<A[], Deleter> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
// test move ctor. Can't copy from lvalue
#include <memory>
#include <cassert>
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()
{
{
std::unique_ptr<A[], Deleter> s(new A[3]);
A* p = s.get();
std::unique_ptr<A[], Deleter> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::
count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
// test move ctor. Can't copy from const lvalue
#include <memory>
#include <cassert>
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 std::unique_ptr<A[], Deleter> s(new A[3]);
A* p = s.get();
std::unique_ptr<A[], Deleter> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::c
ount == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
// test move ctor. Can't copy from const lvalue
#include <memory>
#include <cassert>
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 std::unique_ptr<A[], Deleter> s(new A[3]);
A* p = s.get();
std::unique_ptr<A[], Deleter> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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()
{
{
std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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()
{
{
std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::unique_ptr<A[]> s2(s);
ass
ert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
std::unique_ptr<B[], Deleter<B[]> > s(new
B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
std::unique_ptr<B[], Deleter<B[]> > s(new B);
A* p = s.get
();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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 CDeleter
{
int state_;
CDeleter(CDeleter&);
CDeleter& o
perator=(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;
std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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 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;
std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// implicit version
#include <memory>
#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()
{
{
std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// implicit version
#include <memory>
#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()
{
{
std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::unique_ptr<A[]> s2 = s;
as
sert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Implicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
std::unique_ptr<B[], Deleter<B[]> > s(new
B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Implicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
std::unique_ptr<B[], Deleter<B[]> > s(new B);
A* p = s.get
();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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 CDeleter
{
int state_;
CDeleter(CDeleter&);
CDeleter& o
perator=(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;
std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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 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;
std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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()
{
{
const std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::uniq
ue_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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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()
{
{
const std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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 std::unique_ptr<B[], Deleter<B[]> >
s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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 std::unique_ptr<B[], Deleter<B[]> > s(new B);
A* p =
s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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 CDeleter
{
int state_;
CDeleter(CDeleter&);
CDeleter& o
perator=(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 std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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 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 std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// implicit version
#include <memory>
#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()
{
{
const std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::uniq
ue_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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// implicit version
#include <memory>
#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()
{
{
const std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Implicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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 std::unique_ptr<B[], Deleter<B[]> >
s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Implicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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 std::unique_ptr<B[], Deleter<B[]> > s(new B);
A* p =
s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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 CDeleter
{
int state_;
CDeleter(CDeleter&);
CDeleter& o
perator=(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 std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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 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 std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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()
{
{
std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::unique_ptr
<A[]> s2(std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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()
{
{
std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::unique_ptr<A[]> s2(std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
std::unique_ptr<B[], Deleter<B[]> > s(new
B);
A* p = s.get();
std::unique_ptr<A[], Deleter<A[]> > s2(std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
std::unique_ptr<B[], Deleter<B[]> > s(new B);
A* p = s.get
();
std::unique_ptr<A[], Deleter<A[]> > s2(std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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 CDeleter
{
int state_;
CDeleter(CDeleter&);
CDeleter& o
perator=(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;
std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
A* p = s.get();
std::unique_ptr<A[], CDeleter<A>&> s2(std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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 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;
std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
A* p = s.get();
std::unique_ptr<A[], CDeleter<A>&> s2(std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// implicit version
#include <memory>
#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()
{
{
std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::unique_ptr
<A[]> s2 = std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// implicit version
#include <memory>
#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()
{
{
std::unique_ptr<B[]> s(new B);
A* p = s.get();
std::unique_ptr<A[]> s2 = std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Implicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
std::unique_ptr<B[], Deleter<B[]> > s(new
B);
A* p = s.get();
std::unique_ptr<A[], Deleter<A[]> > s2 = std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Implicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
std::unique_ptr<B[], Deleter<B[]> > s(new B);
A* p = s.get
();
std::unique_ptr<A[], Deleter<A[]> > s2 = std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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 CDeleter
{
int state_;
CDeleter(CDeleter&);
CDeleter& o
perator=(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;
std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
A* p = s.get();
std::unique_ptr<A[], CDeleter<A>&> s2 = std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#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 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;
std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
A* p = s.get();
std::unique_ptr<A[], CDeleter<A>&> s2 = std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// unique_ptr(nullptr_t);
#include <memory>
#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()
{
{
std::unique_ptr<int[]> p(nullptr);
assert(p.get() == 0);
}
{
std::unique_ptr<int[], Deleter> p(nullptr);
assert(p.get() == 0);
assert(p.get_deleter().state() == 5);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// unique_ptr(nullptr_t);
#include <memory>
#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()
{
{
std::unique_ptr<int[]> p(nullptr);
assert(p.get() == 0);
}
{
std::unique_ptr<int[], Deleter> p(nullptr);
assert(p.get() == 0);
assert(p.get_deleter().state() == 5);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr<T[]>(pointer) ctor
// unique_ptr<T[]>(pointer) ctor should require default Deleter ctor
#include <memory>
class Deleter
{
Deleter() {}
public:
Deleter(Deleter&) {}
Deleter& operator=(Deleter&) {}
void operator()(void*) const {}
};
int main()
{
std::unique_ptr<int[], Deleter> p(new int);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr<T[]>(pointer) ctor
// unique_ptr<T[]>(pointer) ctor should require default Deleter ctor
#include <memory>
class Deleter
{
Deleter() {}
public:
Deleter(Deleter&) {}
Deleter& operator=(Deleter&) {}
void operator()(void*) const {}
};
int main()
{
std::unique_ptr<int[], Deleter> p(new int);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
// unique_ptr<T[]>(pointer) ctor should only require default Deleter ctor
#include <memory>
#include <cassert>
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);
std::unique_ptr<A[]> s(p);
assert(s.get()
== p);
}
assert(A::count == 0);
{
A* p = new A[3];
assert(A::count == 3);
std::unique_ptr<A[], Deleter> s(p);
assert(s.get() == p);
assert(s.get_deleter().state() == 5);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
// unique_ptr<T[]>(pointer) ctor should only require default Deleter ctor
#include <memory>
#include <cassert>
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);
std::unique_ptr<A[]> s(p);
assert(s.get() == p);
}
as
sert(A::count == 0);
{
A* p = new A[3];
assert(A::count == 3);
std::unique_ptr<A[], Deleter> s(p);
assert(s.get() == p);
assert(s.get_deleter().state() == 5);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr<T[]>(pointer) ctor
#include <memory>
// unique_ptr<T[]>(pointer) ctor should require non-reference Deleter ctor
class Deleter
{
public:
void operator()(void*) {}
};
int main()
{
std::unique_ptr<int[], Deleter&> p(new int);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr<T[]>(pointer) ctor
#include <memory>
// unique_ptr<T[]>(pointer) ctor should require non-reference Deleter ctor
class Deleter
{
public:
void operator()(void*) {}
};
int main()
{
std::unique_ptr<int[], Deleter&> p(new int);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr<T[]>(pointer) ctor
// unique_ptr<T[]>(pointer) ctor shouldn't require complete type
#include <memory>
#include <cassert>
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 = std::default_delete<A[]> >
struct B
{
std::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() {}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr<T[]>(pointer) ctor
// unique_ptr<T[]>(pointer) ctor shouldn't require complete type
#include <memory>
#include <cassert>
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 = std::default_delete<A[]> >
struct B
{
std::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() {}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr<T[]>(pointer) ctor
// unique_ptr<T[]>(pointer) ctor should require non-pointer Deleter
#include <memory>
int main()
{
std::unique_ptr<int[], void (*)(void*)> p(new int);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr<T[]>(pointer) ctor
// unique_ptr<T[]>(pointer) ctor should require non-pointer Deleter
#include <memory>
int main()
{
std::unique_ptr<int[], void (*)(void*)> p(new int);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
// unique_ptr(pointer) ctor should not work with derived pointers
#include <memory>
#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;
class Deleter
{
int state_;
Deleter(Deleter&);
Deleter& operator=(Deleter&);
public:
Deleter() : state_(5) {}
int state() const {return state_;}
void operato
r()(A* p) {delete [] p;}
};
int main()
{
{
B* p = new B[3];
std::unique_ptr<A[]> s(p);
}
{
B* p = new B[3];
std::unique_ptr<A[], Deleter> s(p);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
// unique_ptr(pointer) ctor should not work with derived pointers
#include <memory>
#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;
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];
std::unique_ptr<A[]> s(p);
}
{
B* p = new B[3];
std::unique_ptr<A[], Deleter> s(p);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer, deleter) ctor
// unique_ptr(pointer, deleter()) only requires MoveConstructible deleter
#include <memory>
#include <cassert>
#include "../../deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
A* p = new A[3];
assert(A::count == 3);
std::unique_ptr<A[], Deleter<A[]> > s(p, Deleter<A[]>());
assert(s.get() == p);
assert(s.get_deleter().state() == 0);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer, deleter) ctor
// unique_ptr(pointer, deleter()) only requires MoveConstructible deleter
#include <memory>
#include <cassert>
#include "../../deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
A* p = new A[3];
assert(A::count == 3);
std::unique_ptr<A[], Deleter<A[]> > s(p, Deleter<A[]>());
assert(s.get() == p);
assert(s.get_deleter().state() == 0);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer, deleter) ctor
// unique_ptr(pointer, d) requires CopyConstructible deleter
#include <memory>
#include <cassert>
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;
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer, deleter) ctor
// unique_ptr(pointer, d) requires CopyConstructible deleter
#include <memory>
#include <cassert>
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;
std::unique_ptr<A[], Deleter> s(p, d);
assert(s.get() == p);
as
sert(s.get_deleter().state() == 5);
d.set_state(6);
assert(s.get_deleter().state() == 5);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer, deleter) ctor
// unique_ptr<T[], D&>(pointer, d) does not requires CopyConstructible deleter
#include <memory>
#include <cassert>
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;
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer, deleter) ctor
// unique_ptr<T[], D&>(pointer, d) does not requires CopyConstructible deleter
#include <memory>
#include <cassert>
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;
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer, deleter) ctor
// unique_ptr<T, const D&>(pointer, D()) should not compile
#include <memory>
#include <cassert>
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);
std::unique_ptr<A[], const Deleter&> s(p, Deleter());
ass
ert(s.get() == p);
assert(s.get_deleter().state() == 5);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer, deleter) ctor
// unique_ptr<T, const D&>(pointer, D()) should not compile
#include <memory>
#include <cassert>
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);
std::unique_ptr<A[], const Deleter&> s(p, Deleter());
assert(s.get() == p);
assert(s.get_deleter().state() == 5);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer, deleter) ctor
// unique_ptr<T[], const D&>(pointer, d) does not requires CopyConstructible deleter
#include <memory>
#include <cassert>
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;
std::unique_ptr<A[], const Deleter&> s(p, d);
assert(s.get() == p);
assert(s.get_deleter().state() == 5);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer, deleter) ctor
// unique_ptr<T[], const D&>(pointer, d) does not requires CopyConstructible deleter
#include <memory>
#include <cassert>
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::coun
t == 3);
Deleter d;
std::unique_ptr<A[], const Deleter&> s(p, d);
assert(s.get() == p);
assert(s.get_deleter().state() == 5);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer, deleter) ctor
// unique_ptr(pointer, deleter) should not work with derived pointers
#include <memory>
#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;
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];
std::unique_ptr<A[], Deleter> s(p, Deleter());
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer, deleter) ctor
// unique_ptr(pointer, deleter) should not work with derived pointers
#include <memory>
#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;
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];
std::unique_ptr<A[], Deleter> s(p, Deleter());
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test release
#include <memory>
#include <cassert>
int main()
{
std::unique_ptr<int[]> p(new int[3]);
int* i = p.get();
int* j = p.release();
assert(p.get() == 0);
assert(i == j);
delete [] j;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test release
#include <memory>
#include <cassert>
int main()
{
std::unique_ptr<int[]> p(new int[3]);
int* i = p.get();
int* j = p.release();
assert(p.get() == 0);
assert(i == j);
delete [] j;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test reset
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::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);
{
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test reset
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::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);
{
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test reset
#include <memory>
#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()
{
{
std::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);
{
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test reset
#include <memory>
#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()
{
{
std::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);
{
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test swap
#include <memory>
#include <cassert>
#include "../../deleter.h"
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;
int main()
{
{
A* p1 = new A[3];
std::unique_ptr<A[], Deleter<A[]> > s1(p1, Deleter<A[]>(1));
A* p2 = new A[3];
std::unique_ptr<
A[], Deleter<A[]> > s2(p2, Deleter<A[]>(2));
assert(s1.get() == p1);
assert(s1.get_deleter().state() == 1);
assert(s2.get() == p2);
assert(s2.get_deleter().state() == 2);
s1.swap(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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test swap
#include <memory>
#include <cassert>
#include "../../deleter.h"
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;
int main()
{
{
A* p1 = new A[3];
std::unique_ptr<A[], Deleter<A[]> > s1(p1, Deleter<A[]>(1));
A* p2 = new A[3];
std::unique_ptr<A[], Deleter<A[]> >
s2(p2, Deleter<A[]>(2));
assert(s1.get() == p1);
assert(s1.get_deleter().state() == 1);
assert(s2.get() == p2);
assert(s2.get_deleter().state() == 2);
s1.swap(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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op*()
#include <memory>
#include <cassert>
int main()
{
std::unique_ptr<int[]> p(new int(3));
assert(*p == 3);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op*()
#include <memory>
#include <cassert>
int main()
{
std::unique_ptr<int[]> p(new int(3));
assert(*p == 3);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op*()
#include <memory>
#include <cassert>
int main()
{
{
std::unique_ptr<int[]> p(new int [3]);
if (p)
;
else
assert(false);
if (!p)
assert(false);
}
{
std::unique_ptr<int[]> p;
if (!p)
;
else
assert(false);
if (p)
assert(false);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op*()
#include <memory>
#include <cassert>
int main()
{
{
std::unique_ptr<int[]> p(new int [3]);
if (p)
;
else
assert(false);
if (!p)
assert(false);
}
{
std::unique_ptr<int[]> p;
if (!p)
;
else
assert(false);
if (p)
assert(false);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test get
#include <memory>
#include <cassert>
int main()
{
int* p = new int[3];
std::unique_ptr<int[]> s(p);
assert(s.get() == p);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test get
#include <memory>
#include <cassert>
int main()
{
int* p = new int[3];
std::unique_ptr<int[]> s(p);
assert(s.get() == p);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test get_deleter()
#include <memory>
#include <cassert>
struct Deleter
{
void operator()(void*) {}
int test() {return 5;}
int test() const {return 6;}
};
int main()
{
{
std::unique_ptr<int[], Deleter> p;
assert(p.get_deleter().test() == 5);
}
{
const std::unique_ptr<int[], Deleter> p;
assert(p.get_deleter().test() == 6);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test get_deleter()
#include <memory>
#include <cassert>
struct Deleter
{
void operator()(void*) {}
int test() {return 5;}
int test() const {return 6;}
};
int main()
{
{
std::unique_ptr<int[], Deleter> p;
assert(p.get_deleter().test() == 5);
}
{
const std::unique_ptr<int[], Deleter> p;
assert(p.get_deleter().test() == 6);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op[](size_t)
#include <memory>
#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()
{
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op[](size_t)
#include <memory>
#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()
{
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op->()
#include <memory>
#include <cassert>
struct A
{
int i_;
A() : i_(7) {}
};
int main()
{
std::unique_ptr<A[]> p(new A);
assert(p->i_ == 7);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// test op->()
#include <memory>
#include <cassert>
struct A
{
int i_;
A() : i_(7) {}
};
int main()
{
std::unique_ptr<A[]> p(new A);
assert(p->i_ == 7);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr::pointer type
#include <memory>
#include <type_traits>
struct Deleter
{
struct pointer {};
};
int main()
{
{
typedef std::unique_ptr<int> P;
static_assert((std::is_same<P::pointer, int*>::value), "");
}
{
typedef std::unique_ptr<int, Deleter> P;
static_assert((std::is_same<P::pointer, Deleter::pointer>::value), "");
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr::pointer type
#include <memory>
#include <type_traits>
struct Deleter
{
struct pointer {};
};
int main()
{
{
typedef std::unique_ptr<int> P;
static_assert((std::is_same<P::pointer, int*>::value), "");
}
{
typedef std::unique_ptr<int, Deleter> P;
static_assert((std::is_same<P::pointer, Deleter::pointer>::value), "");
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A> s(new A);
std::unique_ptr<A> s2;
s2 = s;
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A> s(new A);
std::unique_ptr<A> s2;
s2 = s;
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
// test move assignment. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
#include <memory>
#include <cassert>
#include "../../deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::unique_ptr<A> s1(new A);
A* p = s1.get();
std::unique_ptr<A> s2(new A);
assert(A::count == 2);
s2 = std::move(s1);
assert(A::count == 1);
assert(s2.get() == p);
assert(s1.get() == 0);
}
assert(A::count == 0);
{
std::unique_ptr<A, Deleter<A> > s1(new A, Deleter<A>(5));
A* p = s1.get();
std::unique_ptr<A, Deleter<A> > s2(new A);
assert(A::count == 2);
s2 = std::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);
{
CDeleter<A> d1(5);
std::unique_ptr<A, CDeleter<A>&> s1(new A, d1);
A* p = s1.get();
CDeleter<A> d2(6);
std::unique_ptr<A, CDeleter<A>&> s2(new A, d2);
s2 = std::move(s1);
assert(s2.get() == p);
assert(s1.get() == 0);
assert(A::count == 1);
assert(d1.state() == 5);
assert(d2.state() == 5);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
// test move assignment. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
#include <memory>
#include <cassert>
#include "../../deleter.h"
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
std::unique_ptr<A> s1(new A);
A* p = s1.get();
std::unique_ptr<A> s2(new A);
assert(A::count == 2);
s2 = std::move(s1);
assert(A::count == 1);
assert(s2.get() == p);
assert(s1.get() == 0);
}
assert(A::count ==
0);
{
std::unique_ptr<A, Deleter<A> > s1(new A, Deleter<A>(5));
A* p = s1.get();
std::unique_ptr<A, Deleter<A> > s2(new A);
assert(A::count == 2);
s2 = std::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);
{
CDeleter<A> d1(5);
std::unique_ptr<A, CDeleter<A>&> s1(new A, d1);
A* p = s1.get();
CDeleter<A> d2(6);
std::unique_ptr<A, CDeleter<A>&> s2(new A, d2);
s2 = std::move(s1);
assert(s2.get() == p);
assert(s1.get() == 0);
assert(A::count == 1);
assert(d1.state() == 5);
assert(d2.state() == 5);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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 std::unique_ptr<A> s(new A);
std::unique_ptr<A> s2;
s2 = s;
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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 std::unique_ptr<A> s(new A);
std::unique_ptr<A> s2;
s2 = s;
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A, Deleter> s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter> s2;
s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
ass
ert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A, Deleter> s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter> s2;
s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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 std::unique_ptr<A, Deleter> s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter> s2;
s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::cou
nt == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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 std::unique_ptr<A, Deleter> s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter> s2;
s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#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()
{
{
std::unique_ptr<B> s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#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()
{
{
std::unique_ptr<B> s(new B);
A* p = s.get();
std::unique_ptr<A> s2;
s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
as
sert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#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()
{
{
std::unique_ptr<B> s(new B);
A* p = s.get();
std::unique_ptr<A> s2(new A);
assert(A::count == 2);
s2 = std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#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()
{
{
std::unique_ptr<B> s(new B);
A* p = s.get();
std::unique_ptr<A> s2(new A);
assert(A::count == 2);
s2 = std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#include <cassert>
#include "../../deleter.h"
// 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()
{
{
std::unique_ptr<B, Deleter<B> > s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#include <cassert>
#include "../../deleter.h"
// 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()
{
{
std::unique_ptr<B, Deleter<B> > s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
std::unique_ptr<B, Deleter<B> > s(new B, Deleter<B>(5));
A* p = s.get();
std::unique_ptr<A, Deleter<A> > s2(new A);
assert(A::count == 2);
s2 = std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
std::unique_ptr<B, Deleter<B> > s(new B, Deleter<B>(5));
A* p = s.get();
std::unique_ptr<A, Deleter<A> > s2(new A);
assert(A::count == 2);
s2 = std::move(s);
assert(s2.get() == p);
ass
ert(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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from lvalue
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
Deleter<B> db(5);
std::unique_ptr<B, Deleter<B>&> s(new B, db);
A* p = s.get();
Deleter<A> da(6);
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from lvalue
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
Deleter<B> db(5);
std::unique_ptr<B, Deleter<B>&> s(new B, db);
A* p = s.get();
Deleter<A> da(6);
std::unique_ptr<A, Deleter<A>&> s2(new A, da);
s2 = s;
as
sert(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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// test converting move assignment with reference deleters
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
CDeleter<B> db(5);
std::unique_ptr<B, CDeleter<B>&> s(new B, db);
A* p = s.get();
CDeleter<A> da(6);
std::unique
_ptr<A, CDeleter<A>&> s2(new A, da);
s2 = std::move(s);
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
assert(s.get_deleter().state() == 5);
assert(s2.get_deleter().state() == 5);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// test converting move assignment with reference deleters
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
CDeleter<B> db(5);
std::unique_ptr<B, CDeleter<B>&> s(new B, db);
A* p = s.get();
CDeleter<A> da(6);
std::unique_ptr<A, CDeleter<A>&
> s2(new A, da);
s2 = std::move(s);
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
assert(s.get_deleter().state() == 5);
assert(s2.get_deleter().state() == 5);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#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 std::unique_ptr<B> s(new B);
A* p = s.get();
std::unique_ptr<A> s2;
s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
ass
ert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
#include <memory>
#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 std::unique_ptr<B> s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from const lvalue
#include <memory>
#include <cassert>
#include "../../deleter.h"
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 std::unique_ptr<B, Deleter<B> > s(new B);
A* p = s.get();
std::unique_ptr<A, Deleter<A> > s2;
s2 = s;
assert(s2.get() == p);
as
sert(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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from const lvalue
#include <memory>
#include <cassert>
#include "../../deleter.h"
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 std::unique_ptr<B, Deleter<B> > s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from const lvalue
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
Deleter<B> db(5);
const std::unique_ptr<B, Deleter<B>&> s(new B, db);
A* p = s.get();
Deleter<A> da(6);
std::unique_ptr<A, Deleter<A>&> s
2(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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Can't assign from const lvalue
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
Deleter<B> db(5);
const std::unique_ptr<B, Deleter<B>&> s(new B, db);
A* p = s.get();
Deleter<A> da(6);
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Do not convert from an array unique_ptr
#include <memory>
#include <cassert>
struct A
{
};
struct Deleter
{
void operator()(void*) {}
};
int main()
{
std::unique_ptr<A[], Deleter> s;
std::unique_ptr<A, Deleter> s2;
s2 = std::move(s);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move assignment
// Do not convert from an array unique_ptr
#include <memory>
#include <cassert>
struct A
{
};
struct Deleter
{
void operator()(void*) {}
};
int main()
{
std::unique_ptr<A[], Deleter> s;
std::unique_ptr<A, Deleter> s2;
s2 = std::move(s);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A> s2(new A);
assert(A::count == 1);
s2 = 0;
assert(A::count == 0);
assert(s2.get() == 0);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A> s2(new A);
assert(A::count == 1);
s2 = 0;
assert(A::count == 0);
assert(s2.get() == 0);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A> s2(new A);
assert(A::count == 1);
s2 = nullptr;
assert(A::count == 0);
assert(s2.get() == 0);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move assignment
#include <memory>
#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()
{
{
std::unique_ptr<A> s2(new A);
assert(A::count == 1);
s2 = nullptr;
assert(A::count == 0);
assert(s2.get() == 0);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
#include <cassert>
// template <class U> explicit unique_ptr(auto_ptr<U>&);
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()
{
{
B* p = new B;
std::auto_ptr<B> ap(p);
std::unique_ptr<A> up(ap);
assert(up.get() == p);
assert(ap.get() == 0);
assert(A::count == 1);
assert(B::cou
nt == 1);
}
assert(A::count == 0);
assert(B::count == 0);
{
B* p = new B;
std::auto_ptr<B> ap(p);
std::unique_ptr<A> up;
up = ap;
assert(up.get() == p);
assert(ap.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
{
B* p = new B;
std::auto_ptr<B> ap(p);
std::unique_ptr<A> up;
up = std::move(ap);
assert(up.get() == p);
assert(ap.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
#include <cassert>
// template <class U> explicit unique_ptr(auto_ptr<U>&);
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()
{
{
B* p = new B;
std::auto_ptr<B> ap(p);
std::unique_ptr<A> up(ap);
assert(up.get() == p);
assert(ap.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
{
B* p = new B;
std::auto_ptr<B> ap(p);
std::unique_ptr<A> up;
up = ap;
assert(up.get() == p);
assert(ap.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
{
B* p = new B;
std::auto_ptr<B> ap(p);
std::unique_ptr<A> up;
up = std::move(ap);
assert(up.get() == p);
assert(ap.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
#include <cassert>
// template <class U> explicit unique_ptr(auto_ptr<U>&);
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()
{
{
B* p = new B;
std::auto_ptr<B> ap(p);
std::unique_ptr<A> up(ap);
assert(up.get() == p);
assert(ap.get() == 0);
assert(A::count == 1);
assert(B::c
ount == 1);
}
assert(A::count == 0);
assert(B::count == 0);
{
B* p = new B;
std::auto_ptr<B> ap(p);
std::unique_ptr<A> up;
up = ap;
assert(up.get() == p);
assert(ap.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
#include <cassert>
// template <class U> explicit unique_ptr(auto_ptr<U>&);
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()
{
{
B* p = new B;
std::auto_ptr<B> ap(p);
std::unique_ptr<A> up(ap);
assert(up.get() == p);
assert(ap.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
{
B* p = new B;
std::auto_ptr<B> ap(p);
std::unique_ptr<A> up;
up = ap;
assert(up.get() == p);
assert(ap.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
#include <cassert>
// template <class U> explicit unique_ptr(auto_ptr<U>&);
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;
struct Deleter
{
template <class T>
void operator()(T*) {}
};
int main()
{
{
B* p = new B;
std::auto_ptr<B> ap(p);
std::unique_ptr<A, Deleter> up(ap);
assert(up.
get() == p);
assert(ap.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
#include <cassert>
// template <class U> explicit unique_ptr(auto_ptr<U>&);
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;
struct Deleter
{
template <class T>
void operator()(T*) {}
};
int main()
{
{
B* p = new B;
std::auto_ptr<B> ap(p);
std::unique_ptr<A, Deleter> up(ap);
assert(up.get() == p);
ass
ert(ap.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
#include <memory>
// default unique_ptr ctor should require default Deleter ctor
class Deleter
{
Deleter() {}
public:
Deleter(Deleter&) {}
Deleter& operator=(Deleter&) {}
void operator()(void*) const {}
};
int main()
{
std::unique_ptr<int, Deleter> p;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
#include <memory>
// default unique_ptr ctor should require default Deleter ctor
class Deleter
{
Deleter() {}
public:
Deleter(Deleter&) {}
Deleter& operator=(Deleter&) {}
void operator()(void*) const {}
};
int main()
{
std::unique_ptr<int, Deleter> p;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
#include <memory>
#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()
{
{
std::unique_ptr<int> p;
assert(p.get() == 0);
}
{
std::unique_ptr<int, Deleter> p;
assert(p.get() == 0);
assert(p.get_deleter().state() == 5);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
#include <memory>
#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()
{
{
std::unique_ptr<int> p;
assert(p.get() == 0);
}
{
std::unique_ptr<int, Deleter> p;
assert(p.get() == 0);
assert(p.get_deleter().state() == 5);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
#include <memory>
// default unique_ptr ctor should require non-reference Deleter ctor
class Deleter
{
public:
void operator()(void*) {}
};
int main()
{
std::unique_ptr<int, Deleter&> p;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
#include <memory>
// default unique_ptr ctor should require non-reference Deleter ctor
class Deleter
{
public:
void operator()(void*) {}
};
int main()
{
std::unique_ptr<int, Deleter&> p;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test default unique_ptr ctor
#include <memory>
#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 = std::default_delete<A> >
struct B
{
std::unique_ptr<A, D> a_;
B() {}
~B();
A* get() const {return a_.get();}
D& get_deleter() {return a_.get_deleter();}
};
int main()
{
{
B<> s;
asser
t(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() {}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test default unique_ptr ctor
#include <memory>
#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 = std::default_delete<A> >
struct B
{
std::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() {}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
#include <memory>
// default unique_ptr ctor should require non-pointer Deleter
int main()
{
std::unique_ptr<int, void (*)(void*)> p;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr default ctor
#include <memory>
// default unique_ptr ctor should require non-pointer Deleter
int main()
{
std::unique_ptr<int, void (*)(void*)> p;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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()
{
{
std::unique_ptr<A> s(new A);
A* p = s.get();
std::unique_ptr<A> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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()
{
{
std::unique_ptr<A> s(new A);
A* p = s.get();
std::unique_ptr<A> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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;
template <class T>
class Deleter
{
int state_;
#ifdef _LIBCPP_MOVE
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
#else
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif
public:
#ifdef _LIBCPP_MOVE
Deleter(Deleter&& r) : state_(r.state_) {r.s
tate_ = 0;}
Deleter& operator=(Deleter&& r)
{
state_ = r.state_;
r.state_ = 0;
return *this;
}
#else
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif
Deleter() : state_(5) {}
#ifdef _LIBCPP_MOVE
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {d.set_state(0);}
private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
template <class U>
Deleter(Deleter<U> d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {}
#endif
public:
int st
ate() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* 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()
{
{
std::unique_ptr<A> s(new A);
A* p = s.get();
std::unique_ptr<A> s2 = std::move(s);
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
{
std::unique_ptr<A, Deleter<A> > s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter<A> > s2 = std::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;
std::unique_ptr<A, CDeleter&> s(new A, d);
A* p = s.get();
std::unique_ptr<A, CDeleter&> s2 = std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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;
template <class T>
class Deleter
{
int state_;
#ifdef _LIBCPP_MOVE
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
#else
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif
public:
#ifdef _LIBCPP_MOVE
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Dele
ter& operator=(Deleter&& r)
{
state_ = r.state_;
r.state_ = 0;
return *this;
}
#else
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif
Deleter() : state_(5) {}
#ifdef _LIBCPP_MOVE
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {d.set_state(0);}
private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
template <class U>
Deleter(Deleter<U> d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {}
#endif
public:
int state() const {return
state_;}
void set_state(int i) {state_ = i;}
void operator()(T* 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()
{
{
std::unique_ptr<A> s(new A);
A* p = s.get();
std::unique_ptr<A> s2 = std::move(s);
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
{
std::unique_ptr<A, Deleter<A> > s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter<A> > s2 = std::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;
std::unique_ptr<A, CDeleter&> s(new A, d);
A* p = s.get();
std::unique_ptr<A, CDeleter&> s2 = std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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 std::unique_ptr<A> s(new A);
A* p = s.get();
std::unique_ptr<A> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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 std::unique_ptr<A> s(new A);
A* p = s.get();
std::unique_ptr<A> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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;
template <class T>
class Deleter
{
int state_;
#ifdef _LIBCPP_MOVE
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
#else
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif
public:
#ifdef _LIBCPP_MOVE
Deleter(Deleter&& r) : state_(r.state_) {r.s
tate_ = 0;}
Deleter& operator=(Deleter&& r)
{
state_ = r.state_;
r.state_ = 0;
return *this;
}
#else
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif
Deleter() : state_(5) {}
#ifdef _LIBCPP_MOVE
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {d.set_state(0);}
private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
template <class U>
Deleter(Deleter<U> d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {}
#endif
public:
int st
ate() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* 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;}
};
std::unique_ptr<A>
source1()
{
return std::unique_ptr<A>(new A);
}
void sink1(std::unique_ptr<A> p)
{
}
std::unique_ptr<A, Deleter<A> >
source2()
{
return std::unique_ptr<A, Deleter<A> >(new A);
}
void sink2(std::unique_ptr<A, Deleter<A> > p)
{
}
std::unique_ptr<A, CDeleter&>
source3()
{
static CDeleter d;
return std::unique_ptr<A, CDeleter&>(new A, d);
}
void sink3(std::unique_ptr<A, CDeleter&> p)
{
}
int main()
{
sink1(source1());
sink2(source2());
sink3(source3());
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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;
template <class T>
class Deleter
{
int state_;
#ifdef _LIBCPP_MOVE
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
#else
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif
public:
#ifdef _LIBCPP_MOVE
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Dele
ter& operator=(Deleter&& r)
{
state_ = r.state_;
r.state_ = 0;
return *this;
}
#else
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif
Deleter() : state_(5) {}
#ifdef _LIBCPP_MOVE
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {d.set_state(0);}
private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
template <class U>
Deleter(Deleter<U> d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {}
#endif
public:
int state() const {return
state_;}
void set_state(int i) {state_ = i;}
void operator()(T* 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;}
};
std::unique_ptr<A>
source1()
{
return std::unique_ptr<A>(new A);
}
void sink1(std::unique_ptr<A> p)
{
}
std::unique_ptr<A, Deleter<A> >
source2()
{
return std::unique_ptr<A, Deleter<A> >(new A);
}
void sink2(std::unique_ptr<A, Deleter<A> > p)
{
}
std::unique_ptr<A, CDeleter&>
source3()
{
static CDeleter d;
return std::unique_ptr<A, CDeleter&>(new A, d);
}
void sink3(std::unique_ptr<A, CDeleter&> p)
{
}
int main()
{
sink1(source1());
sink2(source2());
sink3(source3());
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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()
{
{
std::unique_ptr<A, Deleter> s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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()
{
{
std::unique_ptr<A, Deleter> s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A::count == 0
);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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 std::unique_ptr<A, Deleter> s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1)
;
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr move ctor
#include <memory>
#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 std::unique_ptr<A, Deleter> s(new A);
A* p = s.get();
std::unique_ptr<A, Deleter> s2 = s;
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
}
assert(A
::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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()
{
{
std::unique_ptr<B> s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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()
{
{
std::unique_ptr<B> s(new B);
A* p = s.get();
std::unique_ptr<A> s2(s);
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::coun
t == 0);
assert(B::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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()
{
{
std::unique_ptr<B> s(new B);
A* p = s.get();
std::unique_ptr<A
> s2(std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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()
{
{
std::unique_ptr<B> s(new B);
A* p = s.get();
std::unique_ptr<A> s2(std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
std::unique_ptr<B, Deleter<B> > s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// test converting move ctor. Should only require a MoveConstructible deleter, or if
// deleter is a reference, not even that.
// Explicit version
#include <memory>
#include <cassert>
#include "../../deleter.h"
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()
{
{
std::unique_ptr<B, Deleter<B> > s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#include <cassert>
#include "../../deleter.h"
// 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()
{
{
std::unique_ptr<B, Deleter<B> > s(new B, D
eleter<B>(5));
A* p = s.get();
std::unique_ptr<A, Deleter<A> > s2(std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#include <cassert>
#include "../../deleter.h"
// 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()
{
{
std::unique_ptr<B, Deleter<B> > s(new B, Deleter<B>(5));
A
* p = s.get();
std::unique_ptr<A, Deleter<A> > s2(std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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& o
perator=(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;
std::unique_ptr<B, CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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;
std::unique_ptr<B, CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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& o
perator=(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;
std::unique_ptr<B, CDeleter<A>&> s(new B, d);
A* p = s.get();
std::unique_ptr<A, CDeleter<A>&> s2(std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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;
std::unique_ptr<B, CDeleter<A>&> s(new B, d);
A* p = s.get();
std::unique_ptr<A, CDeleter<A>&> s2(std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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()
{
{
std::unique_ptr<B> s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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()
{
{
std::unique_ptr<B> s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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()
{
{
std::unique_ptr<B> s(new B);
A* p = s.get();
std::unique_ptr<A
> s2 = std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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()
{
{
std::unique_ptr<B> s(new B);
A* p = s.get();
std::unique_ptr<A> s2 = std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#include <cassert>
#include "../../deleter.h"
// 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()
{
std::unique_ptr<B, Deleter<B> > s(new B);
st
d::unique_ptr<A, Deleter<A> > s2 = s;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#include <cassert>
#include "../../deleter.h"
// 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()
{
std::unique_ptr<B, Deleter<B> > s(new B);
std::unique_ptr<A, Del
eter<A> > s2 = s;
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#include <cassert>
#include "../../deleter.h"
// 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()
{
{
std::unique_ptr<B, Deleter<B> > s(new B, D
eleter<B>(5));
A* p = s.get();
std::unique_ptr<A, Deleter<A> > s2 = std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#include <cassert>
#include "../../deleter.h"
// 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()
{
{
std::unique_ptr<B, Deleter<B> > s(new B, Deleter<B>(5));
A
* p = s.get();
std::unique_ptr<A, Deleter<A> > s2 = std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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& o
perator=(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;
std::unique_ptr<B, CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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;
std::unique_ptr<B, CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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& o
perator=(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;
std::unique_ptr<B, CDeleter<A>&> s(new B, d);
A* p = s.get();
std::unique_ptr<A, CDeleter<A>&> s2 = std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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;
std::unique_ptr<B, CDeleter<A>&> s(new B, d);
A* p = s.get();
std::unique_ptr<A, CDeleter<A>&> s2 = std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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 std::unique_ptr<B> s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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 std::unique_ptr<B> s(new B);
A* p = s.get();
std::unique_ptr<A> s2(s);
a
ssert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 1);
assert(B::count == 1);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#include <cassert>
#include "../../deleter.h"
// 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()
{
{
CDeleter<B> b(5);
std::unique_ptr<B, C
Deleter<B>&> s(new B, b);
A* p = s.get();
std::unique_ptr<A, CDeleter<A> > s2 = std::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() == 5);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#include <cassert>
#include "../../deleter.h"
// 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()
{
{
CDeleter<B> b(5);
std::unique_ptr<B, CDeleter<B>&> s(new B
, b);
A* p = s.get();
std::unique_ptr<A, CDeleter<A> > s2 = std::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() == 5);
}
assert(A::count == 0);
assert(B::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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_;
#ifdef _LIBCPP_MOVE
Deleter(const Del
eter&);
Deleter& operator=(const Deleter&);
#else
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif
public:
#ifdef _LIBCPP_MOVE
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
state_ = r.state_;
r.state_ = 0;
return *this;
}
#else
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif
Deleter() : state_(5) {}
#ifdef _LIBCPP_MOVE
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {d.set_state(0);}
private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
template <class U>
Deleter(Deleter<U> d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {}
#endif
public:
int state() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* p) {delete p;}
};
int main()
{
{
const std::unique_ptr<B, Deleter<B> > s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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_;
#ifdef _LIBCPP_MOVE
Deleter(const Deleter&);
Deleter&
operator=(const Deleter&);
#else
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif
public:
#ifdef _LIBCPP_MOVE
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
state_ = r.state_;
r.state_ = 0;
return *this;
}
#else
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif
Deleter() : state_(5) {}
#ifdef _LIBCPP_MOVE
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {d.set_state(0);}
private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
template <
class U>
Deleter(Deleter<U> d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {}
#endif
public:
int state() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* p) {delete p;}
};
int main()
{
{
const std::unique_ptr<B, Deleter<B> > s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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& o
perator=(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 std::unique_ptr<B, CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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 std::unique_ptr<B, CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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 std::unique_ptr<B> s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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 std::unique_ptr<B> s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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_;
#ifdef _LIBCPP_MOVE
Deleter(const Del
eter&);
Deleter& operator=(const Deleter&);
#else
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif
public:
#ifdef _LIBCPP_MOVE
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
state_ = r.state_;
r.state_ = 0;
return *this;
}
#else
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif
Deleter() : state_(5) {}
#ifdef _LIBCPP_MOVE
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {d.set_state(0);}
private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
template <class U>
Deleter(Deleter<U> d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {}
#endif
public:
int state() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* p) {delete p;}
};
int main()
{
{
const std::unique_ptr<B, Deleter<B> > s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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_;
#ifdef _LIBCPP_MOVE
Deleter(const Deleter&);
Deleter&
operator=(const Deleter&);
#else
Deleter(Deleter&);
Deleter& operator=(Deleter&);
#endif
public:
#ifdef _LIBCPP_MOVE
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
state_ = r.state_;
r.state_ = 0;
return *this;
}
#else
operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
Deleter& operator=(std::__rv<Deleter> r)
{
state_ = r->state_;
r->state_ = 0;
return *this;
}
#endif
Deleter() : state_(5) {}
#ifdef _LIBCPP_MOVE
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {d.set_state(0);}
private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
template <
class U>
Deleter(Deleter<U> d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
: state_(d.state()) {}
#endif
public:
int state() const {return state_;}
void set_state(int i) {state_ = i;}
void operator()(T* p) {delete p;}
};
int main()
{
{
const std::unique_ptr<B, Deleter<B> > s(new B);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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& o
perator=(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 std::unique_ptr<B, CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
#include <memory>
#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 std::unique_ptr<B, CDeleter<A>&> s(new B, d);
A* p = s.get();
std::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);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// Do not convert from an array unique_ptr
#include <memory>
#include <cassert>
struct A
{
};
struct Deleter
{
void operator()(void*) {}
};
int main()
{
std::unique_ptr<A[], Deleter> s;
std::unique_ptr<A, Deleter> s2(std::move(s));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr converting move ctor
// Do not convert from an array unique_ptr
#include <memory>
#include <cassert>
struct A
{
};
struct Deleter
{
void operator()(void*) {}
};
int main()
{
std::unique_ptr<A[], Deleter> s;
std::unique_ptr<A, Deleter> s2(std::move(s));
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/nullptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/nullptr.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/nullptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/nullptr.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// unique_ptr(nullptr_t);
#include <memory>
#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()
{
{
std::unique_ptr<int> p(nullptr);
assert(p.get() == 0);
}
{
std::unique_ptr<int, Deleter> p(nullptr);
assert(p.get() == 0);
assert(p.get_deleter().state() == 5);
}
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// unique_ptr(nullptr_t);
#include <memory>
#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()
{
{
std::unique_ptr<int> p(nullptr);
assert(p.get() == 0);
}
{
std::unique_ptr<int, Deleter> p(nullptr);
assert(p.get() == 0);
assert(p.get_deleter().state() == 5);
}
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
// unique_ptr(pointer) ctor should require default Deleter ctor
class Deleter
{
Deleter() {}
public:
Deleter(Deleter&) {}
Deleter& operator=(Deleter&) {}
void operator()(void*) const {}
};
int main()
{
std::unique_ptr<int, Deleter> p(new int);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
// unique_ptr(pointer) ctor should require default Deleter ctor
class Deleter
{
Deleter() {}
public:
Deleter(Deleter&) {}
Deleter& operator=(Deleter&) {}
void operator()(void*) const {}
};
int main()
{
std::unique_ptr<int, Deleter> p(new int);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
#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);
std::unique_ptr<A> s(p);
assert(s.get() == p);
}
assert(A::count == 0);
{
A* p = new A;
assert(A::count == 1);
std::unique_ptr<A, Deleter> s(p);
assert(s.get() == p);
assert(s.get_deleter().state() == 5);
}
assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
#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);
std::unique_ptr<A> s(p);
assert(s.get() == p);
}
assert(A::count
== 0);
{
A* p = new A;
assert(A::count == 1);
std::unique_ptr<A, Deleter> s(p);
assert(s.get() == p);
assert(s.get_deleter().state() == 5);
}
assert(A::count == 0);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
// unique_ptr(pointer) ctor should require non-reference Deleter ctor
class Deleter
{
public:
void operator()(void*) {}
};
int main()
{
std::unique_ptr<int, Deleter&> p(new int);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
// unique_ptr(pointer) ctor should require non-reference Deleter ctor
class Deleter
{
public:
void operator()(void*) {}
};
int main()
{
std::unique_ptr<int, Deleter&> p(new int);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.pass.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.pass.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
#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 = std::default_delete<A> >
struct B
{
std::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() {}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
#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 = std::default_delete<A> >
struct B
{
std::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() {}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp?rev=103516&r1=103515&r2=103516&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp Tue May 11 16:36:01 2010
@@ -1 +1 @@
-//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
// unique_ptr(pointer) ctor should require non-pointer Deleter
int main()
{
std::unique_ptr<int, void (*)(void*)> p(new int);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr(pointer) ctor
#include <memory>
// unique_ptr(pointer) ctor should require non-pointer Deleter
int main()
{
std::unique_ptr<int, void (*)(void*)> p(new int);
}
\ No newline at end of file
Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.pass.cpp
URL: