Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*!
0002 @file
0003 Forward declares `boost::hana::permutations`.
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_PERMUTATIONS_HPP
0011 #define BOOST_HANA_FWD_PERMUTATIONS_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Return a sequence of all the permutations of the given sequence.
0019     //! @ingroup group-Sequence
0020     //!
0021     //! Specifically, `permutations(xs)` is a sequence whose elements are
0022     //! permutations of the original sequence `xs`. The permutations are not
0023     //! guaranteed to be in any specific order. Also note that the number
0024     //! of permutations grows very rapidly as the length of the original
0025     //! sequence increases. The growth rate is `O(length(xs)!)`; with a
0026     //! sequence `xs` of length only 8, `permutations(xs)` contains over
0027     //! 40 000 elements!
0028     //!
0029     //!
0030     //! Example
0031     //! -------
0032     //! @include example/permutations.cpp
0033 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0034     constexpr auto permutations = [](auto&& xs) {
0035         return tag-dispatched;
0036     };
0037 #else
0038     template <typename S, typename = void>
0039     struct permutations_impl : permutations_impl<S, when<true>> { };
0040 
0041     struct permutations_t {
0042         template <typename Xs>
0043         constexpr auto operator()(Xs&& xs) const;
0044     };
0045 
0046     BOOST_HANA_INLINE_VARIABLE constexpr permutations_t permutations{};
0047 #endif
0048 }} // end namespace boost::hana
0049 
0050 #endif // !BOOST_HANA_FWD_PERMUTATIONS_HPP