Edit: /usr/include/boost/hana/tap.hpp (1616B)
/*!
@file
Defines `boost::hana::tap`.
@copyright Louis Dionne 2013-2017
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_TAP_HPP
#define BOOST_HANA_TAP_HPP
#include
#include
#include
#include
#include
#include
BOOST_HANA_NAMESPACE_BEGIN
//! @cond
template
template
constexpr auto tap_t::operator()(F&& f) const {
#ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
static_assert(hana::Monad::value,
"hana::tap requires 'M' to be a Monad");
#endif
using Tap = BOOST_HANA_DISPATCH_IF(tap_impl,
hana::Monad::value
);
return Tap::apply(static_cast(f));
}
//! @endcond
namespace detail {
template
struct tap_helper {
template
constexpr auto operator()(F&& f, X&& x) const {
(void)static_cast(f)(x);
return hana::lift(static_cast(x));
}
};
}
template
struct tap_impl> : default_ {
template
static constexpr auto apply(F&& f)
{ return hana::partial(detail::tap_helper{}, static_cast(f)); }
};
BOOST_HANA_NAMESPACE_END
#endif // !BOOST_HANA_TAP_HPP