1 // Copyright 2019 Hans Dembinski
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #ifndef BOOST_HISTOGRAM_WEIGHT_HPP
8 #define BOOST_HISTOGRAM_WEIGHT_HPP
15 /** Weight holder and type envelope.
17 You should not construct these directly, use the weight() helper function.
19 @tparam Underlying arithmetic type.
23 /// Access underlying value.
26 /// Allow implicit conversions of types when the underlying value type allows them.
28 operator weight_type<U>() const {
29 return weight_type<U>{static_cast<U>(value)};
33 /** Helper function to mark argument as weight.
35 @param t argument to be forward to the histogram.
38 auto weight(T&& t) noexcept {
39 return weight_type<T>{std::forward<T>(t)};
42 } // namespace histogram