1 // Copyright 2019 Hans Dembinski
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #include <boost/core/lightweight_test.hpp>
8 #include <boost/core/lightweight_test_trait.hpp>
9 #include <boost/histogram/detail/compressed_pair.hpp>
10 #include "std_ostream.hpp"
12 using namespace boost::histogram::detail;
15 nothrow_move(nothrow_move&&) noexcept {}
16 nothrow_move& operator=(nothrow_move&&) noexcept { return *this; }
20 throw_move(throw_move&&) {}
21 throw_move& operator=(throw_move&&) { return *this; }
25 BOOST_TEST_TRAIT_TRUE(
26 (std::is_nothrow_move_constructible<compressed_pair<nothrow_move, nothrow_move> >));
28 BOOST_TEST_TRAIT_FALSE(
29 (std::is_nothrow_move_constructible<compressed_pair<nothrow_move, throw_move> >));
31 BOOST_TEST_TRAIT_FALSE(
32 (std::is_nothrow_move_constructible<compressed_pair<throw_move, nothrow_move> >));
34 BOOST_TEST_TRAIT_FALSE(
35 (std::is_nothrow_move_constructible<compressed_pair<throw_move, throw_move> >));
37 BOOST_TEST_GE(sizeof(compressed_pair<int, char>), sizeof(int) + sizeof(char));
38 BOOST_TEST_EQ(sizeof(compressed_pair<int, nothrow_move>), sizeof(int));
39 BOOST_TEST_EQ(sizeof(compressed_pair<int, throw_move>), sizeof(int));
41 return boost::report_errors();