Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.


// Copyright 2019 Hans Dembinski
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at


#include <tuple>
#include <utility>

namespace boost {
namespace histogram {

/** Sample holder and type envelope.

  You should not construct these directly, use the sample() helper function.

  @tparam Underlying type.
template <class T>
struct sample_type {
  T value;

/** Helper function to mark arguments as sample.

  @param ts arguments to be forwarded to the accumulator.
template <class... Ts>
auto sample(Ts&&... ts) noexcept {
  return sample_type<std::tuple<Ts...>>{std::forward_as_tuple(std::forward<Ts>(ts)...)};

} // namespace histogram
} // namespace boost