// 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; // This test makes sure that if_ can be used with non-copyable branches. template struct Boolean { }; namespace boost { namespace hana { template struct while_impl> { // Not implemented }; template struct not_impl> { // Not implemented }; template struct eval_if_impl> { template static constexpr decltype(auto) apply(Cond const&, Then&& t, Else&& e) { return hana::eval_if(hana::bool_c, static_cast(t), static_cast(e)); } }; }} template struct NonCopyable { static constexpr int value = v; NonCopyable() = default; NonCopyable(NonCopyable const&) = delete; NonCopyable(NonCopyable&&) = default; NonCopyable& operator=(NonCopyable const&) = delete; NonCopyable& operator=(NonCopyable&&) = default; }; static_assert(hana::if_(Boolean{}, NonCopyable<3>{}, NonCopyable<4>{}).value == 3, ""); static_assert(hana::if_(Boolean{}, NonCopyable<3>{}, NonCopyable<4>{}).value == 4, ""); int main() { }