Edit: /usr/include/boost/hana/flatten.hpp (1769B)
/*!
@file
Defines `boost::hana::flatten`.
@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_FLATTEN_HPP
#define BOOST_HANA_FLATTEN_HPP
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
BOOST_HANA_NAMESPACE_BEGIN
//! @cond
template
constexpr auto flatten_t::operator()(Xs&& xs) const {
using M = typename hana::tag_of::type;
using Flatten = BOOST_HANA_DISPATCH_IF(flatten_impl,
hana::Monad::value
);
#ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
static_assert(hana::Monad::value,
"hana::flatten(xs) requires 'xs' to be a Monad");
#endif
return Flatten::apply(static_cast(xs));
}
//! @endcond
template
struct flatten_impl> : default_ {
template
static constexpr auto apply(Xs&& xs)
{ return hana::chain(static_cast(xs), hana::id); }
};
template
struct flatten_impl::value>> {
template
static constexpr auto apply(Xs&& xs) {
return detail::unpack_flatten(static_cast(xs), hana::make);
}
};
BOOST_HANA_NAMESPACE_END
#endif // !BOOST_HANA_FLATTEN_HPP