aboutsummaryrefslogtreecommitdiff
path: root/tests/optional/driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/optional/driver.cxx')
-rw-r--r--tests/optional/driver.cxx43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/optional/driver.cxx b/tests/optional/driver.cxx
new file mode 100644
index 0000000..5d72f08
--- /dev/null
+++ b/tests/optional/driver.cxx
@@ -0,0 +1,43 @@
+// file : tests/optional/driver.cxx -*- C++ -*-
+// license : MIT; see accompanying LICENSE file
+
+#include <cassert>
+
+#ifndef __cpp_lib_modules_ts
+#include <vector>
+#include <utility> // move()
+#endif
+
+// Other includes.
+
+#ifdef __cpp_modules_ts
+#ifdef __cpp_lib_modules_ts
+import std.core;
+#endif
+import butl.optional;
+#else
+#include <libbutl/optional.mxx>
+#endif
+
+using namespace std;
+
+struct move_only
+{
+ move_only () = default;
+
+ move_only (move_only&&) = default;
+ move_only& operator= (move_only&&) = default;
+
+ move_only (const move_only&) = delete;
+ move_only& operator= (const move_only&) = delete;
+};
+
+int
+main ()
+{
+ using butl::optional;
+
+ optional<move_only> r;
+ vector<optional<move_only>> rs;
+ rs.emplace_back (move (r));
+}