Blame boost/hana/fuse.hpp
|
Packit |
58578d |
/*!
|
|
Packit |
58578d |
@file
|
|
Packit |
58578d |
Defines `boost::hana::fuse`.
|
|
Packit |
58578d |
|
|
Packit |
58578d |
@copyright Louis Dionne 2013-2017
|
|
Packit |
58578d |
Distributed under the Boost Software License, Version 1.0.
|
|
Packit |
58578d |
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
|
|
Packit |
58578d |
*/
|
|
Packit |
58578d |
|
|
Packit |
58578d |
#ifndef BOOST_HANA_FUSE_HPP
|
|
Packit |
58578d |
#define BOOST_HANA_FUSE_HPP
|
|
Packit |
58578d |
|
|
Packit |
58578d |
#include <boost/hana/fwd/fuse.hpp>
|
|
Packit |
58578d |
|
|
Packit |
58578d |
#include <boost/hana/config.hpp>
|
|
Packit |
58578d |
#include <boost/hana/detail/decay.hpp>
|
|
Packit |
58578d |
#include <boost/hana/unpack.hpp>
|
|
Packit |
58578d |
|
|
Packit |
58578d |
|
|
Packit |
58578d |
BOOST_HANA_NAMESPACE_BEGIN
|
|
Packit |
58578d |
namespace detail {
|
|
Packit |
58578d |
template <typename F>
|
|
Packit |
58578d |
struct fused {
|
|
Packit |
58578d |
F f;
|
|
Packit |
58578d |
template <typename Xs>
|
|
Packit |
58578d |
constexpr decltype(auto) operator()(Xs&& xs) const&
|
|
Packit |
58578d |
{ return hana::unpack(static_cast<Xs&&>(xs), f); }
|
|
Packit |
58578d |
|
|
Packit |
58578d |
template <typename Xs>
|
|
Packit |
58578d |
constexpr decltype(auto) operator()(Xs&& xs) &
|
|
Packit |
58578d |
{ return hana::unpack(static_cast<Xs&&>(xs), f); }
|
|
Packit |
58578d |
|
|
Packit |
58578d |
template <typename Xs>
|
|
Packit |
58578d |
constexpr decltype(auto) operator()(Xs&& xs) &&
|
|
Packit |
58578d |
{ return hana::unpack(static_cast<Xs&&>(xs), static_cast<F&&>(f)); }
|
|
Packit |
58578d |
};
|
|
Packit |
58578d |
}
|
|
Packit |
58578d |
|
|
Packit |
58578d |
//! @cond
|
|
Packit |
58578d |
template <typename F>
|
|
Packit |
58578d |
constexpr auto fuse_t::operator()(F&& f) const {
|
|
Packit |
58578d |
return detail::fused<typename detail::decay<F>::type>{static_cast<F&&>(f)};
|
|
Packit |
58578d |
}
|
|
Packit |
58578d |
//! @endcond
|
|
Packit |
58578d |
BOOST_HANA_NAMESPACE_END
|
|
Packit |
58578d |
|
|
Packit |
58578d |
#endif // !BOOST_HANA_FUSE_HPP
|