summaryrefslogtreecommitdiffstats
path: root/libcxx/src
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2010-08-25 17:32:05 +0000
committerHoward Hinnant <hhinnant@apple.com>2010-08-25 17:32:05 +0000
commitdae3481b28ad0bedd4c5b98385af499cbbe2a10b (patch)
treebb682a9c2b54b54914a58fee5f42fc4c333026b9 /libcxx/src
parentf1f2133ac088f732be5850b5b53439c9356e1ff1 (diff)
downloadbcm5719-llvm-dae3481b28ad0bedd4c5b98385af499cbbe2a10b.tar.gz
bcm5719-llvm-dae3481b28ad0bedd4c5b98385af499cbbe2a10b.zip
Getting started on <future>
llvm-svn: 112061
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/future.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/libcxx/src/future.cpp b/libcxx/src/future.cpp
new file mode 100644
index 00000000000..f9547c6609e
--- /dev/null
+++ b/libcxx/src/future.cpp
@@ -0,0 +1,63 @@
+//===------------------------- future.cpp ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "future"
+#include "string"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+class _LIBCPP_HIDDEN __future_error_category
+ : public __do_message
+{
+public:
+ virtual const char* name() const;
+ virtual string message(int ev) const;
+};
+
+const char*
+__future_error_category::name() const
+{
+ return "future";
+}
+
+string
+__future_error_category::message(int ev) const
+{
+ switch (ev)
+ {
+ case future_errc::broken_promise:
+ return string("The associated promise has been destructed prior "
+ "to the associated state becoming ready.");
+ case future_errc::future_already_retrieved:
+ return string("The future has already been retrieved from "
+ "the promise or packaged_task.");
+ case future_errc::promise_already_satisfied:
+ return string("The state of the promise has already been set.");
+ case future_errc::no_state:
+ return string("Operation not permitted on an object without "
+ "an associated state.");
+ }
+ return string("unspecified future_errc value\n");
+}
+
+
+const error_category&
+future_category()
+{
+ static __future_error_category __f;
+ return __f;
+}
+
+future_error::future_error(error_code __ec)
+ : logic_error(__ec.message()),
+ __ec_(__ec)
+{
+}
+
+_LIBCPP_END_NAMESPACE_STD
OpenPOWER on IntegriCloud