#ifndef BOOST_QVM_DETAIL_MAT_ASSIGN_HPP_INCLUDED #define BOOST_QVM_DETAIL_MAT_ASSIGN_HPP_INCLUDED // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. // 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 #include #include namespace boost { namespace qvm { namespace qvm_detail { template struct assign_mm_defined { static bool const value=false; }; template struct copy_matrix_elements { template static BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL typename enable_if_c< mat_write_element_ref::value, void>::type f( A & a, B const & b ) { mat_traits::template write_element::cols,I%mat_traits::cols>(a) = mat_traits::template read_element::cols,I%mat_traits::cols>(b); copy_matrix_elements::f(a,b); } template static BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL typename enable_if_c< !mat_write_element_ref::value, void>::type f( A & a, B const & b ) { mat_traits::template write_element::cols,I%mat_traits::cols>(a, mat_traits::template read_element::cols,I%mat_traits::cols>(b)); copy_matrix_elements::f(a,b); } }; template struct copy_matrix_elements { template static BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL void f( A &, B const & ) { } }; } template BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_TRIVIAL typename enable_if_c< is_mat::value && is_mat::value && mat_traits::rows==mat_traits::rows && mat_traits::cols==mat_traits::cols && !qvm_detail::assign_mm_defined::rows,mat_traits::cols>::value, A &>::type assign( A & a, B const & b ) { qvm_detail::copy_matrix_elements<0,mat_traits::rows*mat_traits::cols>::f(a,b); return a; } } } #endif