123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #ifndef BOOST_HANA_EXTRACT_HPP
- #define BOOST_HANA_EXTRACT_HPP
- #include <boost/hana/fwd/extract.hpp>
- #include <boost/hana/concept/comonad.hpp>
- #include <boost/hana/config.hpp>
- #include <boost/hana/core/dispatch.hpp>
- BOOST_HANA_NAMESPACE_BEGIN
-
- template <typename W_>
- constexpr decltype(auto) extract_t::operator()(W_&& w) const {
- using W = typename hana::tag_of<W_>::type;
- using Extract = BOOST_HANA_DISPATCH_IF(extract_impl<W>,
- hana::Comonad<W>::value
- );
- #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
- static_assert(hana::Comonad<W>::value,
- "hana::extract(w) requires 'w' to be a Comonad");
- #endif
- return Extract::apply(static_cast<W_&&>(w));
- }
-
- template <typename W, bool condition>
- struct extract_impl<W, when<condition>> : default_ {
- template <typename ...Args>
- static constexpr auto apply(Args&& ...args) = delete;
- };
- BOOST_HANA_NAMESPACE_END
- #endif
|