3 Forward declares `boost::hana::power`.
5 @copyright Louis Dionne 2013-2017
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_HANA_FWD_POWER_HPP
11 #define BOOST_HANA_FWD_POWER_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Elevate a ring element to its `n`th power.
19 //! @ingroup group-Ring
21 //! Specifically, `power(x, n)`, is equivalent to multiplying `x` with
22 //! itself `n` times using the Ring's multiplication. If the power is
23 //! equal to `zero`, the Ring's identity (`one`) is returned.
26 //! A `Ring` element that is elevated to its `n`th power.
29 //! A non-negative `IntegralConstant` representing the power to which `x`
34 //! Only the tag of `x` is used for tag-dispatching.
38 //! @include example/power.cpp
39 #ifdef BOOST_HANA_DOXYGEN_INVOKED
40 constexpr auto power = [](auto&& x, auto const& n) -> decltype(auto) {
41 return tag-dispatched;
44 template <typename R, typename = void>
45 struct power_impl : power_impl<R, when<true>> { };
48 template <typename X, typename N>
49 constexpr decltype(auto) operator()(X&& x, N const& n) const;
52 constexpr power_t power{};
54 BOOST_HANA_NAMESPACE_END
56 #endif // !BOOST_HANA_FWD_POWER_HPP