1 // Copyright 2019 Hans Dembinski 2 // 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) 6 7 #ifndef BOOST_HISTOGRAM_SAMPLE_HPP 8 #define BOOST_HISTOGRAM_SAMPLE_HPP 9 10 #include <tuple> 11 #include <utility> 12 13 namespace boost { 14 namespace histogram { 15 16 template <class T> 17 struct sample_type { 18 T value; 19 }; 20 21 /** Helper function to mark arguments as sample. 22 23 @param ts arguments to be forwarded to the accumulator. 24 */ 25 template <class... Ts> sample(Ts &&...ts)26auto sample(Ts&&... ts) noexcept { 27 return sample_type<std::tuple<Ts...>>{std::forward_as_tuple(std::forward<Ts>(ts)...)}; 28 } 29 30 } // namespace histogram 31 } // namespace boost 32 33 #endif 34