1 // Copyright Louis Dionne 2013-2016
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
5 #ifndef BOOST_HANA_EXAMPLE_CPPCON_2014_MATRIX_COMPARABLE_HPP
6 #define BOOST_HANA_EXAMPLE_CPPCON_2014_MATRIX_COMPARABLE_HPP
10 #include <boost/hana/all.hpp>
11 #include <boost/hana/bool.hpp>
12 #include <boost/hana/equal.hpp>
13 #include <boost/hana/eval_if.hpp>
14 #include <boost/hana/zip_with.hpp>
17 namespace boost { namespace hana {
18 template <unsigned R1, unsigned C1, unsigned R2, unsigned C2>
19 struct equal_impl<cppcon::Matrix<R1, C1>, cppcon::Matrix<R2, C2>> {
20 template <typename M1, typename M2>
21 static constexpr auto apply(M1 const& m1, M2 const& m2) {
22 return eval_if(bool_c<R1 == R2 && C1 == C2>,
24 return all(zip_with(_(equal), cppcon::rows(m1),
27 [] { return false_c; }
33 #endif // !BOOST_HANA_EXAMPLE_CPPCON_2014_MATRIX_COMPARABLE_HPP