1/*=============================================================================
2 Copyright (c) 2017 Paul Fultz II
3 tap.cpp
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6==============================================================================*/
7#include <boost/hof/tap.hpp>
8#include "test.hpp"
9
10struct sum_f
11{
12 template<class T, class U>
13 constexpr T operator()(T x, U y) const
14 {
15 return x+y;
16 }
17};
18
19static constexpr boost::hof::pipable_adaptor<sum_f> sum = {};
20// TODO: Test constexpr
21BOOST_HOF_TEST_CASE()
22{
23 BOOST_HOF_TEST_CHECK(3 == (1 | sum(2)));
24 BOOST_HOF_TEST_CHECK(5 == (1 | sum(2) | boost::hof::tap([](int i) { BOOST_HOF_TEST_CHECK(3 == i); }) | sum(2)));
25}
26

source code of boost/libs/hof/test/tap.cpp