1 /*============================================================================= 2 Copyright (c) 2017 Paul Fultz II 3 decorate.cpp 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 ==============================================================================*/ 7 #include <boost/hof/decorate.hpp> 8 #include "test.hpp" 9 BOOST_HOF_TEST_CASE()10BOOST_HOF_TEST_CASE() 11 { 12 BOOST_HOF_TEST_CHECK(boost::hof::decorate(boost::hof::always(1))(boost::hof::always(1))(boost::hof::always(1))(5) == 1); 13 } 14 15 #if BOOST_HOF_HAS_NOEXCEPT_DEDUCTION 16 struct copy_throws 17 { copy_throwscopy_throws18 copy_throws() {} copy_throwscopy_throws19 copy_throws(copy_throws const&) {} copy_throwscopy_throws20 copy_throws(copy_throws&&) noexcept {} 21 }; 22 23 struct no_throw_fo 24 { operator ()no_throw_fo25 void operator()() const noexcept {} operator ()no_throw_fo26 void operator()(copy_throws) const noexcept {} 27 }; 28 BOOST_HOF_TEST_CASE()29BOOST_HOF_TEST_CASE() 30 { 31 static_assert(noexcept(boost::hof::decorate(boost::hof::always(1))(boost::hof::always(1))(boost::hof::always(1))(5)), "noexcept decorator"); 32 static_assert(!noexcept(boost::hof::decorate(boost::hof::always(1))(boost::hof::always(1))(boost::hof::always(1))(copy_throws{})), "noexcept decorator"); 33 } 34 35 #endif 36