?????????? ????????? - ??????????????? - /home/agenciai/public_html/cd38d8/hana.zip
???????
PK �\�[|:X repeat.hppnu �[��� /*! @file Defines `boost::hana::repeat`. @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_REPEAT_HPP #define BOOST_HANA_REPEAT_HPP #include <boost/hana/fwd/repeat.hpp> #include <boost/hana/concept/integral_constant.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <cstddef> #include <utility> BOOST_HANA_NAMESPACE_BEGIN template <typename I, bool condition> struct repeat_impl<I, when<condition>> : default_ { template <typename F, std::size_t ...i> static constexpr void repeat_helper(F&& f, std::index_sequence<i...>) { using Swallow = std::size_t[]; (void)Swallow{0, ((void)f(), i)...}; } template <typename N, typename F> static constexpr auto apply(N const&, F&& f) { static_assert(N::value >= 0, "hana::repeat(n, f) requires 'n' to be non-negative"); constexpr std::size_t n = N::value; repeat_helper(static_cast<F&&>(f), std::make_index_sequence<n>{}); } }; //! @cond template <typename N, typename F> constexpr void repeat_t::operator()(N const& n, F&& f) const { using I = typename hana::tag_of<N>::type; using Repeat = BOOST_HANA_DISPATCH_IF(repeat_impl<I>, hana::IntegralConstant<I>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::IntegralConstant<I>::value, "hana::repeat(n, f) requires 'n' to be an IntegralConstant"); #endif return Repeat::apply(n, static_cast<F&&>(f)); } //! @endcond BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_REPEAT_HPP PK �\�[^��A A count_if.hppnu �[��� /*! @file Defines `boost::hana::count_if`. @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_COUNT_IF_HPP #define BOOST_HANA_COUNT_IF_HPP #include <boost/hana/fwd/count_if.hpp> #include <boost/hana/concept/foldable.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/detail/algorithm.hpp> #include <boost/hana/detail/fast_and.hpp> #include <boost/hana/integral_constant.hpp> #include <boost/hana/unpack.hpp> #include <cstddef> #include <type_traits> #include <utility> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename Xs, typename Pred> constexpr auto count_if_t::operator()(Xs&& xs, Pred&& pred) const { using S = typename hana::tag_of<Xs>::type; using CountIf = BOOST_HANA_DISPATCH_IF(count_if_impl<S>, hana::Foldable<S>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Foldable<S>::value, "hana::count_if(xs, pred) requires 'xs' to be Foldable"); #endif return CountIf::apply(static_cast<Xs&&>(xs), static_cast<Pred&&>(pred)); } //! @endcond namespace detail { template <typename Pred> struct count_pred { Pred pred; template <typename ...Xs, typename = typename std::enable_if< detail::fast_and< Constant<decltype((*pred)(std::declval<Xs&&>()))>::value... >::value >::type> constexpr auto operator()(Xs&& ...xs) const { constexpr bool results[] = {false, // <-- avoid empty array static_cast<bool>(hana::value<decltype((*pred)(static_cast<Xs&&>(xs)))>())... }; constexpr std::size_t total = detail::count( results, results + sizeof(results), true ); return hana::size_c<total>; } template <typename ...Xs, typename = void, typename = typename std::enable_if< !detail::fast_and< Constant<decltype((*pred)(std::declval<Xs&&>()))>::value... >::value >::type> constexpr auto operator()(Xs&& ...xs) const { std::size_t total = 0; using Swallow = std::size_t[]; (void)Swallow{0, ((*pred)(static_cast<Xs&&>(xs)) ? ++total : 0)...}; return total; } }; } template <typename T, bool condition> struct count_if_impl<T, when<condition>> : default_ { template <typename Xs, typename Pred> static constexpr decltype(auto) apply(Xs&& xs, Pred&& pred) { // We use a pointer instead of a reference to avoid a Clang ICE. return hana::unpack(static_cast<Xs&&>(xs), detail::count_pred<decltype(&pred)>{&pred} ); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_COUNT_IF_HPP PK �\�[F�!�� � group.hppnu �[��� /*! @file Defines `boost::hana::group`. @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_GROUP_HPP #define BOOST_HANA_GROUP_HPP #include <boost/hana/fwd/group.hpp> #include <boost/hana/at.hpp> #include <boost/hana/concept/sequence.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/core/make.hpp> #include <boost/hana/detail/algorithm.hpp> #include <boost/hana/detail/array.hpp> #include <boost/hana/detail/nested_by.hpp> // required by fwd decl #include <boost/hana/equal.hpp> #include <boost/hana/length.hpp> #include <cstddef> #include <utility> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename Xs> constexpr auto group_t::operator()(Xs&& xs) const { using S = typename hana::tag_of<Xs>::type; using Group = BOOST_HANA_DISPATCH_IF(group_impl<S>, hana::Sequence<S>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Sequence<S>::value, "hana::group(xs) requires 'xs' to be a Sequence"); #endif return Group::apply(static_cast<Xs&&>(xs)); } template <typename Xs, typename Predicate> constexpr auto group_t::operator()(Xs&& xs, Predicate&& pred) const { using S = typename hana::tag_of<Xs>::type; using Group = BOOST_HANA_DISPATCH_IF(group_impl<S>, hana::Sequence<S>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Sequence<S>::value, "hana::group(xs, predicate) requires 'xs' to be a Sequence"); #endif return Group::apply(static_cast<Xs&&>(xs), static_cast<Predicate&&>(pred)); } //! @endcond namespace detail { template <typename Xs, std::size_t ...i> constexpr auto get_subsequence_(Xs&& xs, std::index_sequence<i...>) { using S = typename hana::tag_of<Xs>::type; return hana::make<S>(hana::at_c<i>(static_cast<Xs&&>(xs))...); } template <std::size_t offset, typename Indices> struct offset_by; template <std::size_t offset, std::size_t ...i> struct offset_by<offset, std::index_sequence<i...>> { using type = std::index_sequence<(offset + i)...>; }; template <bool ...b> struct group_indices { static constexpr bool bs[sizeof...(b)] = {b...}; static constexpr std::size_t n_groups = detail::count(bs, bs + sizeof(bs), false) + 1; static constexpr auto compute_info() { detail::array<std::size_t, n_groups> sizes{}, offsets{}; for (std::size_t g = 0, i = 0, offset = 0; g < n_groups; ++g) { offsets[g] = offset; sizes[g] = 1; while (i < sizeof...(b) && bs[i++]) ++sizes[g]; offset += sizes[g]; } return std::make_pair(offsets, sizes); } static constexpr auto info = compute_info(); static constexpr auto group_offsets = info.first; static constexpr auto group_sizes = info.second; template <typename S, typename Xs, std::size_t ...i> static constexpr auto finish(Xs&& xs, std::index_sequence<i...>) { return hana::make<S>( detail::get_subsequence_( static_cast<Xs&&>(xs), typename offset_by< group_offsets[i], std::make_index_sequence<group_sizes[i]> >::type{} )... ); } }; } // end namespace detail template <typename S, bool condition> struct group_impl<S, when<condition>> : default_ { template <typename Xs, typename Pred, std::size_t ...i> static constexpr auto group_helper(Xs&& xs, Pred&& pred, std::index_sequence<0, i...>) { using info = detail::group_indices<static_cast<bool>(decltype( pred(hana::at_c<i - 1>(static_cast<Xs&&>(xs)), hana::at_c<i>(static_cast<Xs&&>(xs))) )::value)...>; return info::template finish<S>(static_cast<Xs&&>(xs), std::make_index_sequence<info::n_groups>{} ); } template <typename Xs, typename Pred> static constexpr auto group_helper(Xs&& xs, Pred&&, std::index_sequence<0>) { return hana::make<S>(static_cast<Xs&&>(xs)); } template <typename Xs, typename Pred> static constexpr auto group_helper(Xs&&, Pred&&, std::index_sequence<>) { return hana::make<S>(); } template <typename Xs, typename Pred> static constexpr auto apply(Xs&& xs, Pred&& pred) { constexpr std::size_t len = decltype(hana::length(xs))::value; return group_helper(static_cast<Xs&&>(xs), static_cast<Pred&&>(pred), std::make_index_sequence<len>{}); } template <typename Xs> static constexpr auto apply(Xs&& xs) { return group_impl::apply(static_cast<Xs&&>(xs), hana::equal); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_GROUP_HPP PK �\�[�Z# # front.hppnu �[��� /*! @file Defines `boost::hana::front`. @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_FRONT_HPP #define BOOST_HANA_FRONT_HPP #include <boost/hana/fwd/front.hpp> #include <boost/hana/at.hpp> #include <boost/hana/concept/iterable.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename Xs> constexpr decltype(auto) front_t::operator()(Xs&& xs) const { using It = typename hana::tag_of<Xs>::type; using Front = BOOST_HANA_DISPATCH_IF(front_impl<It>, hana::Iterable<It>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Iterable<It>::value, "hana::front(xs) requires 'xs' to be an Iterable"); #endif return Front::apply(static_cast<Xs&&>(xs)); } //! @endcond template <typename It, bool condition> struct front_impl<It, when<condition>> : default_ { template <typename Xs> static constexpr decltype(auto) apply(Xs&& xs) { return hana::at_c<0>(static_cast<Xs&&>(xs)); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_FRONT_HPP PK �\�[ġz� scan_right.hppnu �[��� /*! @file Defines `boost::hana::scan_right`. @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_SCAN_RIGHT_HPP #define BOOST_HANA_SCAN_RIGHT_HPP #include <boost/hana/fwd/scan_right.hpp> #include <boost/hana/at.hpp> #include <boost/hana/concept/sequence.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/core/make.hpp> #include <boost/hana/empty.hpp> #include <boost/hana/front.hpp> #include <boost/hana/length.hpp> #include <boost/hana/prepend.hpp> #include <cstddef> #include <utility> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename Xs, typename F> constexpr auto scan_right_t::operator()(Xs&& xs, F const& f) const { using S = typename hana::tag_of<Xs>::type; using ScanRight = BOOST_HANA_DISPATCH_IF(scan_right_impl<S>, hana::Sequence<S>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Sequence<S>::value, "hana::scan_right(xs, f) requires 'xs' to be a Sequence"); #endif return ScanRight::apply(static_cast<Xs&&>(xs), f); } template <typename Xs, typename State, typename F> constexpr auto scan_right_t::operator()(Xs&& xs, State&& state, F const& f) const { using S = typename hana::tag_of<Xs>::type; using ScanRight = BOOST_HANA_DISPATCH_IF(scan_right_impl<S>, hana::Sequence<S>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Sequence<S>::value, "hana::scan_right(xs, state, f) requires 'xs' to be a Sequence"); #endif return ScanRight::apply(static_cast<Xs&&>(xs), static_cast<State&&>(state), f); } //! @endcond template <typename S, bool condition> struct scan_right_impl<S, when<condition>> : default_ { // Without initial state template <typename Xs, typename F, std::size_t n1, std::size_t n2, std::size_t ...ns> static constexpr auto apply1_impl(Xs&& xs, F const& f, std::index_sequence<n1, n2, ns...>) { auto rest = scan_right_impl::apply1_impl(static_cast<Xs&&>(xs), f, std::index_sequence<n2, ns...>{}); auto element = f(hana::at_c<n1>(static_cast<Xs&&>(xs)), hana::front(rest)); return hana::prepend(std::move(rest), std::move(element)); } template <typename Xs, typename F, std::size_t n> static constexpr auto apply1_impl(Xs&& xs, F const&, std::index_sequence<n>) { return hana::make<S>(hana::at_c<n>(static_cast<Xs&&>(xs))); } template <typename Xs, typename F> static constexpr auto apply1_impl(Xs&&, F const&, std::index_sequence<>) { return hana::empty<S>(); } template <typename Xs, typename F> static constexpr auto apply(Xs&& xs, F const& f) { constexpr std::size_t Len = decltype(hana::length(xs))::value; return scan_right_impl::apply1_impl(static_cast<Xs&&>(xs), f, std::make_index_sequence<Len>{}); } // With initial state template <typename Xs, typename State, typename F, std::size_t n1, std::size_t n2, std::size_t ...ns> static constexpr auto apply_impl(Xs&& xs, State&& state, F const& f, std::index_sequence<n1, n2, ns...>) { auto rest = scan_right_impl::apply_impl(static_cast<Xs&&>(xs), static_cast<State&&>(state), f, std::index_sequence<n2, ns...>{}); auto element = f(hana::at_c<n1>(static_cast<Xs&&>(xs)), hana::front(rest)); return hana::prepend(std::move(rest), std::move(element)); } template <typename Xs, typename State, typename F, std::size_t n> static constexpr auto apply_impl(Xs&& xs, State&& state, F const& f, std::index_sequence<n>) { auto element = f(hana::at_c<n>(static_cast<Xs&&>(xs)), state); return hana::make<S>(std::move(element), static_cast<State&&>(state)); } template <typename Xs, typename State, typename F> static constexpr auto apply_impl(Xs&&, State&& state, F const&, std::index_sequence<>) { return hana::make<S>(static_cast<State&&>(state)); } template <typename Xs, typename State, typename F> static constexpr auto apply(Xs&& xs, State&& state, F const& f) { constexpr std::size_t Len = decltype(hana::length(xs))::value; return scan_right_impl::apply_impl(static_cast<Xs&&>(xs), static_cast<State&&>(state), f, std::make_index_sequence<Len>{}); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_SCAN_RIGHT_HPP PK �\�[!f�� � adapt_struct.hppnu �[��� /*! @file Defines the `BOOST_HANA_ADAPT_STRUCT` macro. @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_ADAPT_STRUCT_HPP #define BOOST_HANA_ADAPT_STRUCT_HPP #include <boost/hana/fwd/adapt_struct.hpp> #include <boost/hana/detail/struct_macros.hpp> #endif // !BOOST_HANA_ADAPT_STRUCT_HPP PK �\�[y��� fuse.hppnu �[��� /*! @file Defines `boost::hana::fuse`. @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_FUSE_HPP #define BOOST_HANA_FUSE_HPP #include <boost/hana/fwd/fuse.hpp> #include <boost/hana/config.hpp> #include <boost/hana/detail/decay.hpp> #include <boost/hana/unpack.hpp> BOOST_HANA_NAMESPACE_BEGIN namespace detail { template <typename F> struct fused { F f; template <typename Xs> constexpr decltype(auto) operator()(Xs&& xs) const& { return hana::unpack(static_cast<Xs&&>(xs), f); } template <typename Xs> constexpr decltype(auto) operator()(Xs&& xs) & { return hana::unpack(static_cast<Xs&&>(xs), f); } template <typename Xs> constexpr decltype(auto) operator()(Xs&& xs) && { return hana::unpack(static_cast<Xs&&>(xs), static_cast<F&&>(f)); } }; } //! @cond template <typename F> constexpr auto fuse_t::operator()(F&& f) const { return detail::fused<typename detail::decay<F>::type>{static_cast<F&&>(f)}; } //! @endcond BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_FUSE_HPP PK �\�[�Dck k any_of.hppnu �[��� /*! @file Defines `boost::hana::any_of`. @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_ANY_OF_HPP #define BOOST_HANA_ANY_OF_HPP #include <boost/hana/fwd/any_of.hpp> #include <boost/hana/accessors.hpp> #include <boost/hana/at.hpp> #include <boost/hana/bool.hpp> #include <boost/hana/concept/searchable.hpp> #include <boost/hana/concept/sequence.hpp> #include <boost/hana/concept/struct.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/drop_front.hpp> #include <boost/hana/first.hpp> #include <boost/hana/front.hpp> #include <boost/hana/functional/compose.hpp> #include <boost/hana/if.hpp> #include <boost/hana/is_empty.hpp> #include <boost/hana/length.hpp> #include <cstddef> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename Xs, typename Pred> constexpr auto any_of_t::operator()(Xs&& xs, Pred&& pred) const { using S = typename hana::tag_of<Xs>::type; using AnyOf = BOOST_HANA_DISPATCH_IF(any_of_impl<S>, hana::Searchable<S>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Searchable<S>::value, "hana::any_of(xs, pred) requires 'xs' to be a Searchable"); #endif return AnyOf::apply(static_cast<Xs&&>(xs), static_cast<Pred&&>(pred)); } //! @endcond template <typename S, bool condition> struct any_of_impl<S, when<condition>> : default_ { template <typename ...Args> static constexpr auto apply(Args&& ...) = delete; }; template <typename S> struct any_of_impl<S, when<Sequence<S>::value>> { //! @cond template <std::size_t k, std::size_t Len> struct any_of_helper { template <typename Xs, typename Pred> static constexpr auto apply(bool prev_cond, Xs&& xs, Pred&& pred) { return prev_cond ? hana::true_c : any_of_impl::any_of_helper<k + 1, Len>::apply( hana::if_(pred(hana::at_c<k>(xs)), hana::true_c, hana::false_c), static_cast<Xs&&>(xs), static_cast<Pred&&>(pred) ); } template <typename Xs, typename Pred> static constexpr auto apply(hana::true_, Xs&&, Pred&&) { return hana::true_c; } template <typename Xs, typename Pred> static constexpr auto apply(hana::false_, Xs&& xs, Pred&& pred) { auto cond = hana::if_(pred(hana::at_c<k>(xs)), hana::true_c, hana::false_c); return any_of_impl::any_of_helper<k + 1, Len>::apply(cond, static_cast<Xs&&>(xs), static_cast<Pred&&>(pred)); } }; template <std::size_t Len> struct any_of_helper<Len, Len> { template <typename Cond, typename Xs, typename Pred> static constexpr auto apply(Cond cond, Xs&&, Pred&&) { return cond; } }; template <typename Xs, typename Pred> static constexpr auto apply(Xs&& xs, Pred&& pred) { constexpr std::size_t len = decltype(hana::length(xs))::value; return any_of_impl::any_of_helper<0, len>::apply(hana::false_c, static_cast<Xs&&>(xs), static_cast<Pred&&>(pred)); } //! @endcond }; template <typename It> struct any_of_impl<It, when< hana::Iterable<It>::value && !Sequence<It>::value >> { template <typename Xs, typename Pred> static constexpr auto lazy_any_of_helper(hana::false_, bool prev_cond, Xs&& xs, Pred&& pred) { decltype(auto) tail = hana::drop_front(static_cast<Xs&&>(xs)); constexpr bool done = decltype(hana::is_empty(tail))::value; return prev_cond ? hana::true_c : lazy_any_of_helper(hana::bool_<done>{}, hana::if_(pred(hana::front(xs)), hana::true_{}, hana::false_{}), static_cast<decltype(tail)&&>(tail), static_cast<Pred&&>(pred) ); } template <typename Xs, typename Pred> static constexpr auto lazy_any_of_helper(hana::false_, hana::true_, Xs&&, Pred&&) { return hana::true_c; } template <typename Xs, typename Pred> static constexpr auto lazy_any_of_helper(hana::false_, hana::false_, Xs&& xs, Pred&& pred) { constexpr bool done = decltype(hana::is_empty(hana::drop_front(xs)))::value; return lazy_any_of_helper(hana::bool_c<done>, hana::if_(pred(hana::front(xs)), hana::true_c, hana::false_c), hana::drop_front(static_cast<Xs&&>(xs)), static_cast<Pred&&>(pred) ); } template <typename Cond, typename Xs, typename Pred> static constexpr auto lazy_any_of_helper(hana::true_, Cond cond, Xs&&, Pred&&) { return cond; } template <typename Xs, typename Pred> static constexpr auto apply(Xs&& xs, Pred&& pred) { constexpr bool done = decltype(hana::is_empty(xs))::value; return lazy_any_of_helper(hana::bool_c<done>, hana::false_c, static_cast<Xs&&>(xs), static_cast<Pred&&>(pred)); } }; template <typename T, std::size_t N> struct any_of_impl<T[N]> { template <typename Xs, typename Pred> static constexpr bool any_of_helper(bool cond, Xs&& xs, Pred&& pred) { if (cond) return true; for (std::size_t i = 1; i < N; ++i) if (pred(static_cast<Xs&&>(xs)[i])) return true; return false; } // Since an array contains homogeneous data, if the predicate returns // a compile-time logical at any index, it must do so at every index // (because the type of the elements won't change)! In this case, we // then only need to evaluate the predicate on the first element. template <typename Xs, typename Pred> static constexpr auto any_of_helper(hana::true_, Xs&& /*xs*/, Pred&&) { return hana::true_c; } template <typename Xs, typename Pred> static constexpr auto any_of_helper(hana::false_, Xs&&, Pred&&) { return hana::false_c; } template <typename Xs, typename Pred> static constexpr auto apply(Xs&& xs, Pred&& pred) { auto cond = hana::if_(pred(static_cast<Xs&&>(xs)[0]), hana::true_c, hana::false_c); return any_of_helper(cond, static_cast<Xs&&>(xs), static_cast<Pred&&>(pred)); } }; template <typename S> struct any_of_impl<S, when<hana::Struct<S>::value>> { template <typename X, typename Pred> static constexpr decltype(auto) apply(X const&, Pred&& pred) { return hana::any_of(hana::accessors<S>(), hana::compose(static_cast<Pred&&>(pred), hana::first)); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_ANY_OF_HPP PK �\�[�� lazy.hppnu �[��� /*! @file Defines `boost::hana::lazy`. @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_LAZY_HPP #define BOOST_HANA_LAZY_HPP #include <boost/hana/fwd/lazy.hpp> #include <boost/hana/basic_tuple.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/make.hpp> #include <boost/hana/detail/decay.hpp> #include <boost/hana/detail/operators/adl.hpp> #include <boost/hana/detail/operators/monad.hpp> #include <boost/hana/functional/apply.hpp> #include <boost/hana/functional/compose.hpp> #include <boost/hana/functional/on.hpp> #include <boost/hana/fwd/ap.hpp> #include <boost/hana/fwd/duplicate.hpp> #include <boost/hana/fwd/eval.hpp> #include <boost/hana/fwd/extend.hpp> #include <boost/hana/fwd/extract.hpp> #include <boost/hana/fwd/flatten.hpp> #include <boost/hana/fwd/lift.hpp> #include <boost/hana/fwd/transform.hpp> #include <cstddef> #include <type_traits> #include <utility> BOOST_HANA_NAMESPACE_BEGIN ////////////////////////////////////////////////////////////////////////// // lazy ////////////////////////////////////////////////////////////////////////// template <typename Indices, typename F, typename ...Args> struct lazy_apply_t; namespace detail { struct lazy_secret { }; } template <std::size_t ...n, typename F, typename ...Args> struct lazy_apply_t<std::index_sequence<n...>, F, Args...> : detail::operators::adl<> { template <typename ...T> constexpr lazy_apply_t(detail::lazy_secret, T&& ...t) : storage_{static_cast<T&&>(t)...} { } basic_tuple<F, Args...> storage_; using hana_tag = lazy_tag; }; template <typename X> struct lazy_value_t : detail::operators::adl<> { template <typename Y> constexpr lazy_value_t(detail::lazy_secret, Y&& y) : storage_{static_cast<Y&&>(y)} { } basic_tuple<X> storage_; using hana_tag = lazy_tag; // If this is called, we assume that `X` is in fact a function. template <typename ...Args> constexpr lazy_apply_t< std::make_index_sequence<sizeof...(Args)>, X, typename detail::decay<Args>::type... > operator()(Args&& ...args) const& { return {detail::lazy_secret{}, hana::at_c<0>(storage_), static_cast<Args&&>(args)...}; } template <typename ...Args> constexpr lazy_apply_t< std::make_index_sequence<sizeof...(Args)>, X, typename detail::decay<Args>::type... > operator()(Args&& ...args) && { return {detail::lazy_secret{}, static_cast<X&&>(hana::at_c<0>(storage_)), static_cast<Args&&>(args)... }; } }; ////////////////////////////////////////////////////////////////////////// // make<lazy_tag> ////////////////////////////////////////////////////////////////////////// template <> struct make_impl<lazy_tag> { template <typename X> static constexpr lazy_value_t<typename detail::decay<X>::type> apply(X&& x) { return {detail::lazy_secret{}, static_cast<X&&>(x)}; } }; ////////////////////////////////////////////////////////////////////////// // Operators ////////////////////////////////////////////////////////////////////////// namespace detail { template <> struct monad_operators<lazy_tag> { static constexpr bool value = true; }; } ////////////////////////////////////////////////////////////////////////// // eval for lazy_tag ////////////////////////////////////////////////////////////////////////// template <> struct eval_impl<lazy_tag> { // lazy_apply_t template <std::size_t ...n, typename F, typename ...Args> static constexpr decltype(auto) apply(lazy_apply_t<std::index_sequence<n...>, F, Args...> const& expr) { return hana::at_c<0>(expr.storage_)( hana::at_c<n+1>(expr.storage_)... ); } template <std::size_t ...n, typename F, typename ...Args> static constexpr decltype(auto) apply(lazy_apply_t<std::index_sequence<n...>, F, Args...>& expr) { return hana::at_c<0>(expr.storage_)( hana::at_c<n+1>(expr.storage_)... ); } template <std::size_t ...n, typename F, typename ...Args> static constexpr decltype(auto) apply(lazy_apply_t<std::index_sequence<n...>, F, Args...>&& expr) { return static_cast<F&&>(hana::at_c<0>(expr.storage_))( static_cast<Args&&>(hana::at_c<n+1>(expr.storage_))... ); } // lazy_value_t template <typename X> static constexpr X const& apply(lazy_value_t<X> const& expr) { return hana::at_c<0>(expr.storage_); } template <typename X> static constexpr X& apply(lazy_value_t<X>& expr) { return hana::at_c<0>(expr.storage_); } template <typename X> static constexpr X apply(lazy_value_t<X>&& expr) { return static_cast<X&&>(hana::at_c<0>(expr.storage_)); } }; ////////////////////////////////////////////////////////////////////////// // Functor ////////////////////////////////////////////////////////////////////////// template <> struct transform_impl<lazy_tag> { template <typename Expr, typename F> static constexpr auto apply(Expr&& expr, F&& f) { return hana::make_lazy(hana::compose(static_cast<F&&>(f), hana::eval))( static_cast<Expr&&>(expr) ); } }; ////////////////////////////////////////////////////////////////////////// // Applicative ////////////////////////////////////////////////////////////////////////// template <> struct lift_impl<lazy_tag> { template <typename X> static constexpr lazy_value_t<typename detail::decay<X>::type> apply(X&& x) { return {detail::lazy_secret{}, static_cast<X&&>(x)}; } }; template <> struct ap_impl<lazy_tag> { template <typename F, typename X> static constexpr decltype(auto) apply(F&& f, X&& x) { return hana::make_lazy(hana::on(hana::apply, hana::eval))( static_cast<F&&>(f), static_cast<X&&>(x) ); } }; ////////////////////////////////////////////////////////////////////////// // Monad ////////////////////////////////////////////////////////////////////////// template <> struct flatten_impl<lazy_tag> { template <typename Expr> static constexpr decltype(auto) apply(Expr&& expr) { return hana::make_lazy(hana::compose(hana::eval, hana::eval))( static_cast<Expr&&>(expr) ); } }; ////////////////////////////////////////////////////////////////////////// // Comonad ////////////////////////////////////////////////////////////////////////// template <> struct extract_impl<lazy_tag> { template <typename Expr> static constexpr decltype(auto) apply(Expr&& expr) { return hana::eval(static_cast<Expr&&>(expr)); } }; template <> struct duplicate_impl<lazy_tag> { template <typename Expr> static constexpr decltype(auto) apply(Expr&& expr) { return hana::make_lazy(static_cast<Expr&&>(expr)); } }; template <> struct extend_impl<lazy_tag> { template <typename Expr, typename F> static constexpr decltype(auto) apply(Expr&& expr, F&& f) { return hana::make_lazy(static_cast<F&&>(f))(static_cast<Expr&&>(expr)); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_LAZY_HPP PK �\�[?��Tb b core.hppnu �[��� /*! @file Defines the @ref group-core module. @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_CORE_HPP #define BOOST_HANA_CORE_HPP #include <boost/hana/core/common.hpp> #include <boost/hana/core/to.hpp> #include <boost/hana/core/default.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/core/is_a.hpp> #include <boost/hana/core/make.hpp> #include <boost/hana/core/tag_of.hpp> #include <boost/hana/core/when.hpp> #endif // !BOOST_HANA_CORE_HPP PK �\�[�1�� � unfold_left.hppnu �[��� /*! @file Defines `boost::hana::unfold_left`. @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_UNFOLD_LEFT_HPP #define BOOST_HANA_UNFOLD_LEFT_HPP #include <boost/hana/fwd/unfold_left.hpp> #include <boost/hana/append.hpp> #include <boost/hana/concept/sequence.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/empty.hpp> #include <boost/hana/first.hpp> #include <boost/hana/functional/partial.hpp> #include <boost/hana/optional.hpp> #include <boost/hana/second.hpp> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename S> struct unfold_left_t { #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Sequence<S>::value, "hana::unfold_left<S> requires 'S' to be a Sequence"); #endif template <typename State, typename F> constexpr auto operator()(State&& state, F&& f) const { return unfold_left_impl<S>::apply( static_cast<State&&>(state), static_cast<F&&>(f) ); } }; //! @endcond template <typename S, bool condition> struct unfold_left_impl<S, when<condition>> : default_ { struct unfold_left_helper { template <typename F, typename P> constexpr auto operator()(F&& f, P&& p) const { return hana::append( unfold_left_impl::apply( hana::first(static_cast<P&&>(p)), static_cast<F&&>(f) ), hana::second(static_cast<P&&>(p)) ); } }; template <typename Init, typename F> static constexpr auto apply(Init&& init, F&& f) { decltype(auto) elt = f(static_cast<Init&&>(init)); return hana::maybe(empty<S>(), hana::partial(unfold_left_helper{}, static_cast<F&&>(f)), static_cast<decltype(elt)&&>(elt) ); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_UNFOLD_LEFT_HPP PK �\�[�$�`� � one.hppnu �[��� /*! @file Defines `boost::hana::one`. @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_ONE_HPP #define BOOST_HANA_ONE_HPP #include <boost/hana/fwd/one.hpp> #include <boost/hana/concept/constant.hpp> #include <boost/hana/concept/ring.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/to.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/detail/canonical_constant.hpp> #include <type_traits> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename R> constexpr decltype(auto) one_t<R>::operator()() const { #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Ring<R>::value, "hana::one<R>() requires 'R' to be a Ring"); #endif using One = BOOST_HANA_DISPATCH_IF(one_impl<R>, hana::Ring<R>::value ); return One::apply(); } //! @endcond template <typename R, bool condition> struct one_impl<R, when<condition>> : default_ { template <typename ...Args> static constexpr auto apply(Args&& ...) = delete; }; ////////////////////////////////////////////////////////////////////////// // Model for non-boolean arithmetic data types ////////////////////////////////////////////////////////////////////////// template <typename T> struct one_impl<T, when<std::is_arithmetic<T>::value && !std::is_same<bool, T>::value>> { static constexpr T apply() { return static_cast<T>(1); } }; ////////////////////////////////////////////////////////////////////////// // Model for Constants over a Ring ////////////////////////////////////////////////////////////////////////// namespace detail { template <typename C> struct constant_from_one { static constexpr auto value = hana::one<typename C::value_type>(); using hana_tag = detail::CanonicalConstant<typename C::value_type>; }; } template <typename C> struct one_impl<C, when< hana::Constant<C>::value && Ring<typename C::value_type>::value >> { static constexpr decltype(auto) apply() { return hana::to<C>(detail::constant_from_one<C>{}); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_ONE_HPP PK �\�[��� � monadic_fold_left.hppnu �[��� /*! @file Defines `boost::hana::monadic_fold_left`. @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_MONADIC_FOLD_LEFT_HPP #define BOOST_HANA_MONADIC_FOLD_LEFT_HPP #include <boost/hana/fwd/monadic_fold_left.hpp> #include <boost/hana/chain.hpp> #include <boost/hana/concept/foldable.hpp> #include <boost/hana/concept/monad.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/detail/decay.hpp> #include <boost/hana/fold_right.hpp> #include <boost/hana/functional/curry.hpp> #include <boost/hana/functional/partial.hpp> #include <boost/hana/lift.hpp> #include <type_traits> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename M> template <typename Xs, typename State, typename F> constexpr decltype(auto) monadic_fold_left_t<M>::operator()(Xs&& xs, State&& state, F&& f) const { using S = typename hana::tag_of<Xs>::type; using MonadicFoldLeft = BOOST_HANA_DISPATCH_IF(monadic_fold_left_impl<S>, hana::Foldable<S>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Monad<M>::value, "hana::monadic_fold_left<M> requires 'M' to be a Monad"); static_assert(hana::Foldable<S>::value, "hana::monadic_fold_left<M>(xs, state, f) requires 'xs' to be Foldable"); #endif return MonadicFoldLeft::template apply<M>(static_cast<Xs&&>(xs), static_cast<State&&>(state), static_cast<F&&>(f)); } //! @endcond //! @cond template <typename M> template <typename Xs, typename F> constexpr decltype(auto) monadic_fold_left_t<M>::operator()(Xs&& xs, F&& f) const { using S = typename hana::tag_of<Xs>::type; using MonadicFoldLeft = BOOST_HANA_DISPATCH_IF(monadic_fold_left_impl<S>, hana::Foldable<S>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Monad<M>::value, "hana::monadic_fold_left<M> requires 'M' to be a Monad"); static_assert(hana::Foldable<S>::value, "hana::monadic_fold_left<M>(xs, f) requires 'xs' to be Foldable"); #endif return MonadicFoldLeft::template apply<M>(static_cast<Xs&&>(xs), static_cast<F&&>(f)); } //! @endcond namespace detail { struct foldlM_helper { template <typename F, typename X, typename K, typename Z> constexpr decltype(auto) operator()(F&& f, X&& x, K&& k, Z&& z) const { return hana::chain( static_cast<F&&>(f)( static_cast<Z&&>(z), static_cast<X&&>(x) ), static_cast<K&&>(k) ); } }; template <typename End, typename M, typename F> struct monadic_foldl1_helper { F f; template <typename X, typename Y> constexpr decltype(auto) operator()(X&& x, Y&& y) const { return f(static_cast<X&&>(x), static_cast<Y&&>(y)); } template <typename Y> constexpr decltype(auto) operator()(End, Y&& y) const { return hana::lift<M>(static_cast<Y&&>(y)); } }; } template <typename T, bool condition> struct monadic_fold_left_impl<T, when<condition>> : default_ { // with state template <typename M, typename Xs, typename S, typename F> static constexpr decltype(auto) apply(Xs&& xs, S&& s, F&& f) { return hana::fold_right( static_cast<Xs&&>(xs), hana::lift<M>, hana::curry<3>(hana::partial( detail::foldlM_helper{}, static_cast<F&&>(f) )) )(static_cast<S&&>(s)); } // without state template <typename M, typename Xs, typename F> static constexpr decltype(auto) apply(Xs&& xs, F&& f) { struct end { }; using G = detail::monadic_foldl1_helper<end, M, typename detail::decay<F>::type>; decltype(auto) result = hana::monadic_fold_left<M>( static_cast<Xs&&>(xs), end{}, G{static_cast<F&&>(f)} ); static_assert(!std::is_same< std::remove_reference_t<decltype(result)>, decltype(hana::lift<M>(end{})) >{}, "hana::monadic_fold_left<M>(xs, f) requires 'xs' to be non-empty"); return result; } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_MONADIC_FOLD_LEFT_HPP PK �\�[�ݤ� � zip_with.hppnu �[��� /*! @file Defines `boost::hana::zip_with`. @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_ZIP_WITH_HPP #define BOOST_HANA_ZIP_WITH_HPP #include <boost/hana/fwd/zip_with.hpp> #include <boost/hana/at.hpp> #include <boost/hana/concept/sequence.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/core/make.hpp> #include <boost/hana/detail/fast_and.hpp> #include <boost/hana/length.hpp> #include <cstddef> #include <utility> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename F, typename Xs, typename ...Ys> constexpr auto zip_with_t::operator()(F&& f, Xs&& xs, Ys&& ...ys) const { #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(detail::fast_and< hana::Sequence<Xs>::value, hana::Sequence<Ys>::value... >::value, "hana::zip_with(f, xs, ys...) requires 'xs' and 'ys...' to be Sequences"); #endif return zip_with_impl<typename hana::tag_of<Xs>::type>::apply( static_cast<F&&>(f), static_cast<Xs&&>(xs), static_cast<Ys&&>(ys)... ); } //! @endcond template <typename S> struct zip_with_impl<S, when<Sequence<S>::value>> { template <std::size_t N, typename F, typename ...Xs> static constexpr decltype(auto) transverse(F&& f, Xs&& ...xs) { return static_cast<F&&>(f)(hana::at_c<N>(static_cast<Xs&&>(xs))...); } template <std::size_t ...N, typename F, typename ...Xs> static constexpr auto zip_helper(std::index_sequence<N...>, F&& f, Xs&& ...xs) { return hana::make<S>(transverse<N>(f, xs...)...); } template <typename F, typename X, typename ...Xs> static constexpr auto apply(F&& f, X&& x, Xs&& ...xs) { constexpr std::size_t N = decltype(hana::length(x))::value; return zip_helper(std::make_index_sequence<N>{}, static_cast<F&&>(f), static_cast<X&&>(x), static_cast<Xs&&>(xs)...); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_ZIP_WITH_HPP PK �\�[�$��5 5 append.hppnu �[��� /*! @file Defines `boost::hana::append`. @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_APPEND_HPP #define BOOST_HANA_APPEND_HPP #include <boost/hana/fwd/append.hpp> #include <boost/hana/at.hpp> #include <boost/hana/concat.hpp> #include <boost/hana/concept/monad_plus.hpp> #include <boost/hana/concept/sequence.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/core/make.hpp> #include <boost/hana/length.hpp> #include <boost/hana/lift.hpp> #include <cstddef> #include <utility> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename Xs, typename X> constexpr auto append_t::operator()(Xs&& xs, X&& x) const { using M = typename hana::tag_of<Xs>::type; using Append = BOOST_HANA_DISPATCH_IF(append_impl<M>, hana::MonadPlus<M>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::MonadPlus<M>::value, "hana::append(xs, x) requires 'xs' to be a MonadPlus"); #endif return Append::apply(static_cast<Xs&&>(xs), static_cast<X&&>(x)); } //! @endcond template <typename M, bool condition> struct append_impl<M, when<condition>> : default_ { template <typename Xs, typename X> static constexpr auto apply(Xs&& xs, X&& x) { return hana::concat(static_cast<Xs&&>(xs), hana::lift<M>(static_cast<X&&>(x))); } }; template <typename S> struct append_impl<S, when<Sequence<S>::value>> { template <typename Xs, typename X, std::size_t ...i> static constexpr auto append_helper(Xs&& xs, X&& x, std::index_sequence<i...>) { return hana::make<S>( hana::at_c<i>(static_cast<Xs&&>(xs))..., static_cast<X&&>(x) ); } template <typename Xs, typename X> static constexpr auto apply(Xs&& xs, X&& x) { constexpr std::size_t N = decltype(hana::length(xs))::value; return append_helper(static_cast<Xs&&>(xs), static_cast<X&&>(x), std::make_index_sequence<N>{}); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_APPEND_HPP PK �\�[�h� � flatten.hppnu �[��� /*! @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 <boost/hana/fwd/flatten.hpp> #include <boost/hana/concept/monad.hpp> #include <boost/hana/concept/sequence.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/core/make.hpp> #include <boost/hana/detail/unpack_flatten.hpp> #include <boost/hana/functional/id.hpp> #include <boost/hana/fwd/chain.hpp> #include <cstddef> #include <utility> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename Xs> constexpr auto flatten_t::operator()(Xs&& xs) const { using M = typename hana::tag_of<Xs>::type; using Flatten = BOOST_HANA_DISPATCH_IF(flatten_impl<M>, hana::Monad<M>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Monad<M>::value, "hana::flatten(xs) requires 'xs' to be a Monad"); #endif return Flatten::apply(static_cast<Xs&&>(xs)); } //! @endcond template <typename M, bool condition> struct flatten_impl<M, when<condition>> : default_ { template <typename Xs> static constexpr auto apply(Xs&& xs) { return hana::chain(static_cast<Xs&&>(xs), hana::id); } }; template <typename S> struct flatten_impl<S, when<Sequence<S>::value>> { template <typename Xs> static constexpr auto apply(Xs&& xs) { return detail::unpack_flatten(static_cast<Xs&&>(xs), hana::make<S>); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_FLATTEN_HPP PK �\�[�'� � fill.hppnu �[��� /*! @file Defines `boost::hana::fill`. @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_FILL_HPP #define BOOST_HANA_FILL_HPP #include <boost/hana/fwd/fill.hpp> #include <boost/hana/concept/functor.hpp> #include <boost/hana/concept/sequence.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/core/make.hpp> #include <boost/hana/functional/always.hpp> #include <boost/hana/transform.hpp> #include <boost/hana/unpack.hpp> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename Xs, typename Value> constexpr auto fill_t::operator()(Xs&& xs, Value&& value) const { using S = typename hana::tag_of<Xs>::type; using Fill = BOOST_HANA_DISPATCH_IF(fill_impl<S>, hana::Functor<S>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Functor<S>::value, "hana::fill(xs, value) requires 'xs' to be a Functor"); #endif return Fill::apply(static_cast<Xs&&>(xs), static_cast<Value&&>(value)); } //! @endcond template <typename Fun, bool condition> struct fill_impl<Fun, when<condition>> : default_ { template <typename Xs, typename Value> static constexpr auto apply(Xs&& xs, Value&& v) { return hana::transform(static_cast<Xs&&>(xs), hana::always(static_cast<Value&&>(v)) ); } }; template <typename S> struct fill_impl<S, when<Sequence<S>::value>> { //! @cond template <typename V> struct filler { V const& v; template <typename ...Xs> constexpr auto operator()(Xs const& ...xs) const { return hana::make<S>(((void)xs, v)...); } }; //! @endcond template <typename Xs, typename V> static constexpr auto apply(Xs const& xs, V const& v) { return hana::unpack(xs, filler<V>{v}); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_FILL_HPP PK �\�[�)G�L L intersection.hppnu �[��� /*! @file Defines `boost::hana::intersection`. @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_INTERSECTION_HPP #define BOOST_HANA_INTERSECTION_HPP #include <boost/hana/fwd/intersection.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename Xs, typename Ys> constexpr auto intersection_t::operator()(Xs&& xs, Ys&& ys) const { using S = typename hana::tag_of<Xs>::type; using Intersection = BOOST_HANA_DISPATCH_IF(intersection_impl<S>, true ); return Intersection::apply(static_cast<Xs&&>(xs), static_cast<Ys&&>(ys)); } //! @endcond template <typename S, bool condition> struct intersection_impl<S, when<condition>> : default_ { template <typename ...Args> static constexpr auto apply(Args&& ...) = delete; }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_INTERSECTION_HPP PK �\�['u��� � functional.hppnu �[��� /*! @file Defines the @ref group-functional module. @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_FUNCTIONAL_HPP #define BOOST_HANA_FUNCTIONAL_HPP #include <boost/hana/functional/always.hpp> #include <boost/hana/functional/apply.hpp> #include <boost/hana/functional/arg.hpp> #include <boost/hana/functional/capture.hpp> #include <boost/hana/functional/compose.hpp> #include <boost/hana/functional/curry.hpp> #include <boost/hana/functional/demux.hpp> #include <boost/hana/functional/fix.hpp> #include <boost/hana/functional/flip.hpp> #include <boost/hana/functional/id.hpp> #include <boost/hana/functional/infix.hpp> #include <boost/hana/functional/iterate.hpp> #include <boost/hana/functional/lockstep.hpp> #include <boost/hana/functional/on.hpp> #include <boost/hana/functional/overload.hpp> #include <boost/hana/functional/overload_linearly.hpp> #include <boost/hana/functional/partial.hpp> #include <boost/hana/functional/placeholder.hpp> #include <boost/hana/functional/reverse_partial.hpp> #endif // !BOOST_HANA_FUNCTIONAL_HPP PK �\�[����x x empty.hppnu �[��� /*! @file Defines `boost::hana::empty`. @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_EMPTY_HPP #define BOOST_HANA_EMPTY_HPP #include <boost/hana/fwd/empty.hpp> #include <boost/hana/concept/monad_plus.hpp> #include <boost/hana/concept/sequence.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/core/make.hpp> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename M> constexpr auto empty_t<M>::operator()() const { #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::MonadPlus<M>::value, "hana::empty<M>() requires 'M' to be a MonadPlus"); #endif using Empty = BOOST_HANA_DISPATCH_IF(empty_impl<M>, hana::MonadPlus<M>::value ); return Empty::apply(); } //! @endcond template <typename M, bool condition> struct empty_impl<M, when<condition>> : default_ { template <typename ...Args> static constexpr auto apply(Args&& ...) = delete; }; template <typename S> struct empty_impl<S, when<Sequence<S>::value>> { static constexpr auto apply() { return hana::make<S>(); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_EMPTY_HPP PK �\�[G�B}� � min.hppnu �[��� /*! @file Defines `boost::hana::min`. @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_MIN_HPP #define BOOST_HANA_MIN_HPP #include <boost/hana/fwd/min.hpp> #include <boost/hana/concept/orderable.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/if.hpp> #include <boost/hana/less.hpp> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename X, typename Y> constexpr decltype(auto) min_t::operator()(X&& x, Y&& y) const { using T = typename hana::tag_of<X>::type; using U = typename hana::tag_of<Y>::type; using Min = BOOST_HANA_DISPATCH_IF(decltype(min_impl<T, U>{}), hana::Orderable<T>::value && hana::Orderable<U>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Orderable<T>::value, "hana::min(x, y) requires 'x' to be Orderable"); static_assert(hana::Orderable<U>::value, "hana::min(x, y) requires 'y' to be Orderable"); #endif return Min::apply(static_cast<X&&>(x), static_cast<Y&&>(y)); } //! @endcond template <typename T, typename U, bool condition> struct min_impl<T, U, when<condition>> : default_ { template <typename X, typename Y> static constexpr decltype(auto) apply(X&& x, Y&& y) { decltype(auto) cond = hana::less(x, y); return hana::if_(static_cast<decltype(cond)&&>(cond), static_cast<X&&>(x), static_cast<Y&&>(y) ); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_MIN_HPP PK �\�[:r^]� � integral_constant.hppnu �[��� /*! @file Defines `boost::hana::integral_constant`. @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_INTEGRAL_CONSTANT_HPP #define BOOST_HANA_INTEGRAL_CONSTANT_HPP #include <boost/hana/bool.hpp> #endif // !BOOST_HANA_INTEGRAL_CONSTANT_HPP PK �\�[?�9k k transform.hppnu �[��� /*! @file Defines `boost::hana::transform`. @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_TRANSFORM_HPP #define BOOST_HANA_TRANSFORM_HPP #include <boost/hana/fwd/transform.hpp> #include <boost/hana/bool.hpp> #include <boost/hana/concept/functor.hpp> #include <boost/hana/concept/sequence.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/core/make.hpp> #include <boost/hana/functional/always.hpp> #include <boost/hana/fwd/adjust_if.hpp> #include <boost/hana/unpack.hpp> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename Xs, typename F> constexpr auto transform_t::operator()(Xs&& xs, F&& f) const { using S = typename hana::tag_of<Xs>::type; using Transform = BOOST_HANA_DISPATCH_IF(transform_impl<S>, hana::Functor<S>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Functor<S>::value, "hana::transform(xs, f) requires 'xs' to be a Functor"); #endif return Transform::apply(static_cast<Xs&&>(xs), static_cast<F&&>(f)); } //! @endcond template <typename Fun, bool condition> struct transform_impl<Fun, when<condition>> : default_ { template <typename Xs, typename F> static constexpr auto apply(Xs&& xs, F&& f) { return hana::adjust_if(static_cast<Xs&&>(xs), hana::always(hana::true_c), static_cast<F&&>(f)); } }; template <typename S> struct transform_impl<S, when<Sequence<S>::value>> { //! @cond template <typename F> struct transformer { F f; template <typename ...Xs> constexpr auto operator()(Xs&& ...xs) const { return hana::make<S>((*f)(static_cast<Xs&&>(xs))...); } }; //! @endcond template <typename Xs, typename F> static constexpr auto apply(Xs&& xs, F&& f) { // We use a pointer to workaround a Clang 3.5 ICE return hana::unpack(static_cast<Xs&&>(xs), transformer<decltype(&f)>{&f}); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_TRANSFORM_HPP PK �\�[#v9� � replicate.hppnu �[��� /*! @file Defines `boost::hana::replicate`. @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_REPLICATE_HPP #define BOOST_HANA_REPLICATE_HPP #include <boost/hana/fwd/replicate.hpp> #include <boost/hana/concept/integral_constant.hpp> #include <boost/hana/concept/monad_plus.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/core/make.hpp> #include <boost/hana/cycle.hpp> #include <boost/hana/lift.hpp> #include <cstddef> #include <utility> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename M> template <typename X, typename N> constexpr auto replicate_t<M>::operator()(X&& x, N const& n) const { using Replicate = BOOST_HANA_DISPATCH_IF(replicate_impl<M>, hana::MonadPlus<M>::value && hana::IntegralConstant<N>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::MonadPlus<M>::value, "hana::replicate<M>(x, n) requires 'M' to be a MonadPlus"); static_assert(hana::IntegralConstant<N>::value, "hana::replicate<M>(x, n) requires 'n' to be an IntegralConstant"); #endif return Replicate::apply(static_cast<X&&>(x), n); } //! @endcond template <typename M, bool condition> struct replicate_impl<M, when<condition>> : default_ { template <typename X, typename N> static constexpr auto apply(X&& x, N const& n) { return hana::cycle(hana::lift<M>(static_cast<X&&>(x)), n); } }; template <typename S> struct replicate_impl<S, when<Sequence<S>::value>> { template <typename X, std::size_t ...i> static constexpr auto replicate_helper(X&& x, std::index_sequence<i...>) { return hana::make<S>(((void)i, x)...); } template <typename X, typename N> static constexpr auto apply(X&& x, N const&) { constexpr std::size_t n = N::value; return replicate_helper(static_cast<X&&>(x), std::make_index_sequence<n>{}); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_REPLICATE_HPP PK �\�[�W�Ҷ&