summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/hana/test/tuple/at.rv.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/hana/test/tuple/at.rv.cpp
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/hana/test/tuple/at.rv.cpp')
-rw-r--r--src/boost/libs/hana/test/tuple/at.rv.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/boost/libs/hana/test/tuple/at.rv.cpp b/src/boost/libs/hana/test/tuple/at.rv.cpp
new file mode 100644
index 000000000..e1591609b
--- /dev/null
+++ b/src/boost/libs/hana/test/tuple/at.rv.cpp
@@ -0,0 +1,40 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/assert.hpp>
+#include <boost/hana/tuple.hpp>
+
+#include <support/tracked.hpp>
+
+#include <utility>
+#include <memory>
+namespace hana = boost::hana;
+
+
+int main() {
+ {
+ using T = hana::tuple<std::unique_ptr<int>>;
+ T t(std::unique_ptr<int>(new int(3)));
+ std::unique_ptr<int> p = hana::at_c<0>(std::move(t));
+ BOOST_HANA_RUNTIME_CHECK(*p == 3);
+ }
+ // make sure we don't double-move and do other weird stuff
+ {
+ hana::tuple<Tracked, Tracked, Tracked> xs{
+ Tracked{1}, Tracked{2}, Tracked{3}
+ };
+
+ Tracked a = hana::at_c<0>(std::move(xs)); (void)a;
+ Tracked b = hana::at_c<1>(std::move(xs)); (void)b;
+ Tracked c = hana::at_c<2>(std::move(xs)); (void)c;
+ }
+ // test with nested closures
+ {
+ using Inner = hana::tuple<Tracked, Tracked>;
+ hana::tuple<Inner> xs{Inner{Tracked{1}, Tracked{2}}};
+
+ Tracked a = hana::at_c<0>(hana::at_c<0>(std::move(xs))); (void)a;
+ Tracked b = hana::at_c<1>(hana::at_c<0>(std::move(xs))); (void)b;
+ }
+}