Edit: /usr/include/boost/hana/product.hpp (1701B)
/*!
@file
Defines `boost::hana::product`.
@copyright Louis Dionne 2013-2017
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_PRODUCT_HPP
#define BOOST_HANA_PRODUCT_HPP
#include
#include
#include
#include
#include
#include
#include // required by fwd decl
#include
#include
BOOST_HANA_NAMESPACE_BEGIN
//! @cond
template
template
constexpr decltype(auto) product_t::operator()(Xs&& xs) const {
using S = typename hana::tag_of::type;
using Product = BOOST_HANA_DISPATCH_IF(product_impl,
hana::Foldable::value
);
#ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
static_assert(hana::Ring::value,
"hana::product requires 'R' to be a Ring");
static_assert(hana::Foldable::value,
"hana::product(xs) requires 'xs' to be Foldable");
#endif
return Product::template apply(static_cast(xs));
}
//! @endcond
template
struct product_impl> : default_ {
template
static constexpr decltype(auto) apply(Xs&& xs) {
return hana::fold_left(static_cast(xs), hana::one(), hana::mult);
}
};
BOOST_HANA_NAMESPACE_END
#endif // !BOOST_HANA_PRODUCT_HPP