File indexing completed on 2025-01-30 09:43:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_HANA_EXTRACT_HPP
0011 #define BOOST_HANA_EXTRACT_HPP
0012
0013 #include <boost/hana/fwd/extract.hpp>
0014
0015 #include <boost/hana/concept/comonad.hpp>
0016 #include <boost/hana/config.hpp>
0017 #include <boost/hana/core/dispatch.hpp>
0018
0019
0020 namespace boost { namespace hana {
0021
0022 template <typename W_>
0023 constexpr decltype(auto) extract_t::operator()(W_&& w) const {
0024 using W = typename hana::tag_of<W_>::type;
0025 using Extract = BOOST_HANA_DISPATCH_IF(extract_impl<W>,
0026 hana::Comonad<W>::value
0027 );
0028
0029 #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
0030 static_assert(hana::Comonad<W>::value,
0031 "hana::extract(w) requires 'w' to be a Comonad");
0032 #endif
0033
0034 return Extract::apply(static_cast<W_&&>(w));
0035 }
0036
0037
0038 template <typename W, bool condition>
0039 struct extract_impl<W, when<condition>> : default_ {
0040 template <typename ...Args>
0041 static constexpr auto apply(Args&& ...args) = delete;
0042 };
0043 }}
0044
0045 #endif