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::power`.
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_POWER_HPP
0011 #define BOOST_HANA_FWD_POWER_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Elevate a ring element to its `n`th power.
0019     //! @ingroup group-Ring
0020     //!
0021     //! Specifically, `power(x, n)`, is equivalent to multiplying `x` with
0022     //! itself `n` times using the Ring's multiplication. If the power is
0023     //! equal to `zero`, the Ring's identity (`one`) is returned.
0024     //!
0025     //! @param x
0026     //! A `Ring` element that is elevated to its `n`th power.
0027     //!
0028     //! @param n
0029     //! A non-negative `IntegralConstant` representing the power to which `x`
0030     //! is elevated.
0031     //!
0032     //!
0033     //! @note
0034     //! Only the tag of `x` is used for tag-dispatching.
0035     //!
0036     //! Example
0037     //! -------
0038     //! @include example/power.cpp
0039 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0040     constexpr auto power = [](auto&& x, auto const& n) -> decltype(auto) {
0041         return tag-dispatched;
0042     };
0043 #else
0044     template <typename R, typename = void>
0045     struct power_impl : power_impl<R, when<true>> { };
0046 
0047     struct power_t {
0048         template <typename X, typename N>
0049         constexpr decltype(auto) operator()(X&& x, N const& n) const;
0050     };
0051 
0052     BOOST_HANA_INLINE_VARIABLE constexpr power_t power{};
0053 #endif
0054 }} // end namespace boost::hana
0055 
0056 #endif // !BOOST_HANA_FWD_POWER_HPP