]>
Commit | Line | Data |
---|---|---|
b32b8144 | 1 | // Copyright Louis Dionne 2013-2017 |
7c673cae FG |
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) | |
4 | ||
5 | #ifndef BOOST_HANA_EXAMPLE_CPPCON_2014_MATRIX_FUNCTOR_HPP | |
6 | #define BOOST_HANA_EXAMPLE_CPPCON_2014_MATRIX_FUNCTOR_HPP | |
7 | ||
8 | #include "matrix.hpp" | |
9 | ||
10 | #include <boost/hana/functional/flip.hpp> | |
11 | #include <boost/hana/functional/partial.hpp> | |
12 | #include <boost/hana/concept/functor.hpp> | |
13 | ||
14 | #include <utility> | |
15 | ||
16 | ||
17 | namespace boost { namespace hana { | |
18 | template <unsigned Rows, unsigned Columns> | |
19 | struct transform_impl<cppcon::Matrix<Rows, Columns>> { | |
20 | template <typename M, typename F> | |
21 | static constexpr decltype(auto) apply(M&& m, F&& f) { | |
22 | return unpack( | |
23 | transform( | |
24 | cppcon::rows(std::forward<M>(m)), | |
25 | partial(flip(transform), std::forward<F>(f)) | |
26 | ), | |
27 | cppcon::matrix | |
28 | ); | |
29 | } | |
30 | }; | |
31 | }} | |
32 | ||
33 | #endif // !BOOST_HANA_EXAMPLE_CPPCON_2014_MATRIX_FUNCTOR_HPP |