// Copyright Louis Dionne 2013-2016 // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) #ifndef BOOST_HANA_EXAMPLE_CPPCON_2014_MATRIX_MONOID_HPP #define BOOST_HANA_EXAMPLE_CPPCON_2014_MATRIX_MONOID_HPP #include "matrix.hpp" #include #include #include #include namespace boost { namespace hana { template struct plus_impl, cppcon::Matrix> { template static constexpr decltype(auto) apply(M1&& m1, M2&& m2) { return element_wise(plus)( std::forward(m1), std::forward(m2) ); } }; template struct zero_impl> { static constexpr decltype(auto) apply() { auto zeros = replicate(int_<0>, int_); return unpack(replicate(zeros, int_), cppcon::matrix); } }; }} #endif // !BOOST_HANA_EXAMPLE_CPPCON_2014_MATRIX_MONOID_HPP