2
0
mirror of https://github.com/boostorg/hana.git synced 2026-01-23 05:32:13 +00:00
Files
hana/example/cppcon_2014/functor.cpp
2015-02-01 21:02:18 -05:00

35 lines
861 B
C++

/*
@copyright Louis Dionne 2014
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#include <boost/hana/assert.hpp>
#include <boost/hana/functional/placeholder.hpp>
#include <boost/hana/integral_constant.hpp>
#include "matrix/comparable.hpp"
#include "matrix/functor.hpp"
using namespace boost::hana;
using namespace cppcon;
int main() {
// transform
{
auto m = matrix(
row(1, int_<2>, 3),
row(int_<4>, 5, 6),
row(7, 8, int_<9>)
);
BOOST_HANA_CONSTEXPR_CHECK(transform(m, _ + int_<1>) ==
matrix(
row(2, int_<3>, 4),
row(int_<5>, 6, 7),
row(8, 9, int_<10>)
)
);
}
}