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
Louis Dionne 4bef99d3d0 [Core] Completely remove operators from the core
Properly providing operators for users was too complicated, and it is
judged as being out of Hana's scope.

Instead, operators are now provided by helper classes in the detail::
namespace. Now, we can be as dirty as we want, since it is not part of
the interface anymore.

Fixes #138
Closes #30
2015-06-20 17:56:40 -04:00

36 lines
879 B
C++

/*
@copyright Louis Dionne 2015
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(equal(
transform(m, _ + int_<1>),
matrix(
row(2, int_<3>, 4),
row(int_<5>, 6, 7),
row(8, 9, int_<10>)
)
));
}
}