// 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 #include #include #include #include namespace hana = boost::hana; int main() { { using T = hana::tuple>; T t(std::unique_ptr(new int(3))); std::unique_ptr 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 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; hana::tuple 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; } }