1 /*=============================================================================
2 Copyright (c) 2018 Kohei Takahashi
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
8 #include <boost/config.hpp>
9 #include <boost/fusion/support/unused.hpp>
10 #include <boost/type_traits/detail/yes_no_type.hpp>
11 #include <boost/static_assert.hpp>
12 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
18 void unused_construction()
20 boost::fusion::unused_type dephault
;
22 boost::fusion::unused_type BOOST_ATTRIBUTE_UNUSED parenthesis
= boost::fusion::unused_type();
23 #ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
24 boost::fusion::unused_type BOOST_ATTRIBUTE_UNUSED brace
{};
25 boost::fusion::unused_type BOOST_ATTRIBUTE_UNUSED list_copy
= {};
28 boost::fusion::unused_type copy_copy BOOST_ATTRIBUTE_UNUSED
= dephault
;
29 boost::fusion::unused_type copy_direct
BOOST_ATTRIBUTE_UNUSED (dephault
);
30 #ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
31 boost::fusion::unused_type copy_copy_brace_direct BOOST_ATTRIBUTE_UNUSED
= {dephault
};
32 boost::fusion::unused_type copy_direct_brace BOOST_ATTRIBUTE_UNUSED
{dephault
};
35 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
36 boost::fusion::unused_type move_copy BOOST_ATTRIBUTE_UNUSED
= std::move(dephault
);
37 boost::fusion::unused_type move_direct
BOOST_ATTRIBUTE_UNUSED (std::move(dephault
));
38 #ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
39 boost::fusion::unused_type move_copy_brace_direct BOOST_ATTRIBUTE_UNUSED
= {std::move(dephault
)};
40 boost::fusion::unused_type move_direct_brace BOOST_ATTRIBUTE_UNUSED
{std::move(dephault
)};
47 boost::fusion::unused_type T_copy_copy BOOST_ATTRIBUTE_UNUSED
= value
;
48 boost::fusion::unused_type T_copy_direct
BOOST_ATTRIBUTE_UNUSED (value
);
49 #ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
50 boost::fusion::unused_type T_copy_copy_brace_direct BOOST_ATTRIBUTE_UNUSED
= {value
};
51 boost::fusion::unused_type T_copy_direct_brace BOOST_ATTRIBUTE_UNUSED
{value
};
54 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
55 boost::fusion::unused_type T_move_copy BOOST_ATTRIBUTE_UNUSED
= std::move(value
);
56 boost::fusion::unused_type T_move_direct
BOOST_ATTRIBUTE_UNUSED (std::move(value
));
57 #ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
58 boost::fusion::unused_type T_move_copy_brace_direct BOOST_ATTRIBUTE_UNUSED
= {std::move(value
)};
59 boost::fusion::unused_type T_move_direct_brace BOOST_ATTRIBUTE_UNUSED
{std::move(value
)};
64 void unused_assignment()
66 boost::fusion::unused_type val1
, val2
;
69 #ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
72 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
73 val1
= std::move(val2
);
80 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
81 val1
= std::move(value
);
85 boost::type_traits::yes_type
test_unused(boost::fusion::detail::unused_only
const&);
86 boost::type_traits::no_type
test_unused(...);
90 BOOST_STATIC_ASSERT((sizeof(test_unused(boost::fusion::unused
)) == sizeof(boost::type_traits::yes_type
)));
91 BOOST_STATIC_ASSERT((sizeof(test_unused(0)) == sizeof(boost::type_traits::no_type
)));
93 boost::fusion::unused_type my_unused
;
95 BOOST_STATIC_ASSERT((sizeof(test_unused(my_unused
)) == sizeof(boost::type_traits::yes_type
)));