Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:53:05

0001 /*!
0002 @file
0003 Forward declares `boost::hana::remove`.
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_REMOVE_HPP
0011 #define BOOST_HANA_FWD_REMOVE_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Remove all the elements of a monadic structure that are equal to some
0019     //! value.
0020     //! @ingroup group-MonadPlus
0021     //!
0022     //! Given a monadic structure `xs` and a `value`, `remove` returns a new
0023     //! monadic structure equal to `xs` without all its elements that are
0024     //! equal to the given `value`. `remove` is equivalent to `remove_if`
0025     //! with the `equal.to(value)` predicate, i.e.
0026     //! @code
0027     //!     remove(xs, value) == remove_if(xs, equal.to(value))
0028     //! @endcode
0029     //!
0030     //!
0031     //! Signature
0032     //! ---------
0033     //! Given a MonadPlus `M` and a value of type `T`, the signature is
0034     //! \f$
0035     //!     \mathrm{remove} : M(T) \times T \to M(T)
0036     //! \f$
0037     //!
0038     //! @param xs
0039     //! A monadic structure to remove some elements from.
0040     //!
0041     //! @param value
0042     //! A value that is compared to every element `x` of the structure.
0043     //! Elements of the structure that are equal to that value are removed
0044     //! from the structure. This requires every element to be Comparable
0045     //! with `value`. Furthermore, in the current version of the library,
0046     //! comparing `value` with any element of the structure must yield a
0047     //! compile-time Logical.
0048     //!
0049     //!
0050     //! Example
0051     //! -------
0052     //! @include example/remove.cpp
0053 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0054     constexpr auto remove = [](auto&& xs, auto&& value) {
0055         return tag-dispatched;
0056     };
0057 #else
0058     template <typename M, typename = void>
0059     struct remove_impl : remove_impl<M, when<true>> { };
0060 
0061     struct remove_t {
0062         template <typename Xs, typename Value>
0063         constexpr auto operator()(Xs&& xs, Value&& value) const;
0064     };
0065 
0066     BOOST_HANA_INLINE_VARIABLE constexpr remove_t remove{};
0067 #endif
0068 }} // end namespace boost::hana
0069 
0070 #endif // !BOOST_HANA_FWD_REMOVE_HPP