summaryrefslogtreecommitdiffstats
path: root/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2010-08-22 00:59:46 +0000
committerHoward Hinnant <hhinnant@apple.com>2010-08-22 00:59:46 +0000
commit94b2dd0998230c758abd92c99d3700c971f7a31a (patch)
tree1b9f66ba0b4f8fd99fc02a112d4b7a30c4afe0f6 /libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp
parentd9c6c0b583ac1f1efeec3db571a1028a3c9b7a99 (diff)
downloadbcm5719-llvm-94b2dd0998230c758abd92c99d3700c971f7a31a.tar.gz
bcm5719-llvm-94b2dd0998230c758abd92c99d3700c971f7a31a.zip
Fixing whitespace problems
llvm-svn: 111767
Diffstat (limited to 'libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp')
-rw-r--r--libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp48
1 files changed, 47 insertions, 1 deletions
diff --git a/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp b/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp
index 95ad2f26fb3..61e400ade59 100644
--- a/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp
+++ b/libcxx/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp
@@ -1 +1,47 @@
-//===----------------------------------------------------------------------===// // // 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);
+}
OpenPOWER on IntegriCloud