X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fboost%2Flibs%2Fhana%2Ftest%2Fmap%2Fcnstr.copy.cpp;h=6bf6160777736c26349c7ad578b7160a0ceb5f3d;hb=b32b81446b3b05102be0267e79203f59329c1d97;hp=002a3a8b25e5cccb36417c033e3cc6d0e061e4f8;hpb=215dd7151453fae88e6f968c975b6ce309d42dcf;p=ceph.git diff --git a/ceph/src/boost/libs/hana/test/map/cnstr.copy.cpp b/ceph/src/boost/libs/hana/test/map/cnstr.copy.cpp index 002a3a8b2..6bf616077 100644 --- a/ceph/src/boost/libs/hana/test/map/cnstr.copy.cpp +++ b/ceph/src/boost/libs/hana/test/map/cnstr.copy.cpp @@ -1,17 +1,52 @@ -// Copyright Louis Dionne 2013-2016 +// 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 #include #include #include +#include namespace hana = boost::hana; +struct NoCopy { + NoCopy() = default; + NoCopy(NoCopy const&) = delete; + friend auto operator==(NoCopy const&, NoCopy const&) { return hana::true_c; } + friend auto operator!=(NoCopy const&, NoCopy const&) { return hana::false_c; } +}; + +// Note: It is also useful to check with a non-empty class, because that +// triggers different instantiations due to EBO. +struct NoCopy_nonempty { + NoCopy_nonempty() = default; + NoCopy_nonempty(NoCopy_nonempty const&) = delete; + int i; + friend auto operator==(NoCopy_nonempty const&, NoCopy_nonempty const&) { return hana::true_c; } + friend auto operator!=(NoCopy_nonempty const&, NoCopy_nonempty const&) { return hana::false_c; } +}; + +namespace boost { namespace hana { + template <> + struct hash_impl { + static constexpr auto apply(NoCopy const&) + { return hana::type_c; }; + }; + + template <> + struct hash_impl { + static constexpr auto apply(NoCopy_nonempty const&) + { return hana::type_c; }; + }; +}} + + int main() { { auto t0 = hana::make_map(); @@ -66,4 +101,14 @@ int main() { copy == hana::make_map(hana::make_pair(hana::int_c<2>, std::string{"abcdef"})) ); } + + { + using Map1 = hana::map>; + Map1 map1; + static_assert(!std::is_copy_constructible::value, ""); + + using Map2 = hana::map>; + Map2 map2; + static_assert(!std::is_copy_constructible::value, ""); + } }