// Copyright (C) 2016-2018 T. Zachary Laine // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include template using term = boost::yap::terminal; template using ref = boost::yap::expression_ref; namespace yap = boost::yap; namespace bh = boost::hana; template struct expr { static yap::expr_kind const kind = Kind; Tuple elements; BOOST_YAP_USER_ASSIGN_OPERATOR(expr, ::expr); }; static_assert(yap::detail::copy_or_move::value, ""); static_assert(yap::detail::copy_or_move::value, ""); static_assert(yap::detail::copy_or_move::value, ""); static_assert(!yap::detail::copy_or_move::value, ""); static_assert(!yap::detail::copy_or_move::value, ""); void compile_user_macros() { using namespace boost::hana::literals; expr> negation1; negation1.elements[0_c] = 1; expr> negation2; negation2.elements[0_c] = 2; // Normal-rules assignment. negation2 = negation1; assert(negation2.elements[0_c] == 1); negation2.elements[0_c] = 2; // Normal-rules move assignment. negation2 = std::move(negation1); assert(negation2.elements[0_c] == 1); // Produce a new expression via BOOST_YAP_USER_ASSIGN_OPERATOR. auto expr = negation1 = 2; (void)expr; }