|
|
|||
File indexing completed on 2025-12-15 09:53:05
0001 /*! 0002 @file 0003 Forward declares `boost::hana::transform`. 0004 0005 Copyright Louis Dionne 2013-2022 0006 Distributed under the Boost Software License, Version 1.0. 0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 0008 */ 0009 0010 #ifndef BOOST_HANA_FWD_TRANSFORM_HPP 0011 #define BOOST_HANA_FWD_TRANSFORM_HPP 0012 0013 #include <boost/hana/config.hpp> 0014 #include <boost/hana/core/when.hpp> 0015 0016 0017 namespace boost { namespace hana { 0018 //! Map a function over a `Functor`. 0019 //! @ingroup group-Functor 0020 //! 0021 //! 0022 //! Signature 0023 //! --------- 0024 //! Given `F` a Functor, the signature is 0025 //! \f$ 0026 //! \mathtt{transform} : F(T) \times (T \to U) \to F(U) 0027 //! \f$ 0028 //! 0029 //! @param xs 0030 //! The structure to map `f` over. 0031 //! 0032 //! @param f 0033 //! A function called as `f(x)` on element(s) `x` of the structure, 0034 //! and returning a new value to replace `x` in the structure. 0035 //! 0036 //! 0037 //! Example 0038 //! ------- 0039 //! @include example/transform.cpp 0040 #ifdef BOOST_HANA_DOXYGEN_INVOKED 0041 constexpr auto transform = [](auto&& xs, auto&& f) { 0042 return tag-dispatched; 0043 }; 0044 #else 0045 template <typename Xs, typename = void> 0046 struct transform_impl : transform_impl<Xs, when<true>> { }; 0047 0048 struct transform_t { 0049 template <typename Xs, typename F> 0050 constexpr auto operator()(Xs&& xs, F&& f) const; 0051 }; 0052 0053 BOOST_HANA_INLINE_VARIABLE constexpr transform_t transform{}; 0054 #endif 0055 }} // end namespace boost::hana 0056 0057 #endif // !BOOST_HANA_FWD_TRANSFORM_HPP
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|