Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:13

0001 // Copyright 2019 Hans Dembinski
0002 //
0003 // Distributed under the Boost Software License, Version 1.0.
0004 // (See accompanying file LICENSE_1_0.txt
0005 // or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 #ifndef BOOST_HISTOGRAM_SAMPLE_HPP
0008 #define BOOST_HISTOGRAM_SAMPLE_HPP
0009 
0010 #include <tuple>
0011 #include <utility>
0012 
0013 namespace boost {
0014 namespace histogram {
0015 
0016 /** Sample holder and type envelope.
0017 
0018   You should not construct these directly, use the sample() helper function.
0019 
0020   @tparam Underlying type.
0021 */
0022 template <class T>
0023 struct sample_type {
0024   T value;
0025 };
0026 
0027 /** Helper function to mark arguments as sample.
0028 
0029   @param ts arguments to be forwarded to the accumulator.
0030 */
0031 template <class... Ts>
0032 auto sample(Ts&&... ts) noexcept {
0033   return sample_type<std::tuple<Ts...>>{std::forward_as_tuple(std::forward<Ts>(ts)...)};
0034 }
0035 
0036 } // namespace histogram
0037 } // namespace boost
0038 
0039 #endif