Boost C++ Libraries

...one 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.
PrevUpHomeNext

Reference

Header <boost/histogram.hpp>
Header <boost/histogram/histogram.hpp>
Header <boost/histogram/accumulators.hpp>
Header <boost/histogram/accumulators/mean.hpp>
Header <boost/histogram/accumulators/sum.hpp>
Header <boost/histogram/algorithm/sum.hpp>
Header <boost/histogram/accumulators/thread_safe.hpp>
Header <boost/histogram/accumulators/weighted_mean.hpp>
Header <boost/histogram/accumulators/weighted_sum.hpp>
Header <boost/histogram/algorithm.hpp>
Header <boost/histogram/algorithm/empty.hpp>
Header <boost/histogram/algorithm/project.hpp>
Header <boost/histogram/algorithm/reduce.hpp>
Header <boost/histogram/axis.hpp>
Header <boost/histogram/axis/category.hpp>
Header <boost/histogram/axis/integer.hpp>
Header <boost/histogram/axis/interval_view.hpp>
Header <boost/histogram/axis/iterator.hpp>
Header <boost/histogram/axis/metadata_base.hpp>
Header <boost/histogram/axis/option.hpp>
Header <boost/histogram/axis/polymorphic_bin.hpp>
Header <boost/histogram/axis/regular.hpp>
Header <boost/histogram/axis/traits.hpp>
Header <boost/histogram/axis/variable.hpp>
Header <boost/histogram/axis/variant.hpp>
Header <boost/histogram/fwd.hpp>
Header <boost/histogram/indexed.hpp>
Header <boost/histogram/literals.hpp>
Header <boost/histogram/make_histogram.hpp>
Header <boost/histogram/make_profile.hpp>
Header <boost/histogram/ostream.hpp>
Header <boost/histogram/accumulators/ostream.hpp>
Header <boost/histogram/axis/ostream.hpp>
Header <boost/histogram/sample.hpp>
Header <boost/histogram/serialization.hpp>
Header <boost/histogram/storage_adaptor.hpp>
Header <boost/histogram/unlimited_storage.hpp>
Header <boost/histogram/unsafe_access.hpp>
Header <boost/histogram/weight.hpp>

Includes all standard headers of the Boost.Histogram library.

Extra headers not automatically included are:

namespace boost {
  namespace histogram {
    template<typename Axes, typename Storage> class histogram;
    template<typename A1, typename S1, typename A2, typename S2> 
      auto operator+(const histogram< A1, S1 > &, const histogram< A2, S2 > &);
    template<typename A1, typename S1, typename A2, typename S2> 
      auto operator*(const histogram< A1, S1 > &, const histogram< A2, S2 > &);
    template<typename A1, typename S1, typename A2, typename S2> 
      auto operator-(const histogram< A1, S1 > &, const histogram< A2, S2 > &);
    template<typename A1, typename S1, typename A2, typename S2> 
      auto operator/(const histogram< A1, S1 > &, const histogram< A2, S2 > &);
    template<typename A, typename S> 
      auto operator*(const histogram< A, S > &, double);
    template<typename A, typename S> 
      auto operator*(double, const histogram< A, S > &);
    template<typename A, typename S> 
      auto operator/(const histogram< A, S > &, double);
  }
}

Includes all accumulator headers of the Boost.Histogram library.

Extra header not automatically included:

namespace boost {
  namespace histogram {
    namespace accumulators {
      template<typename RealType> class mean;
    }
  }
}
namespace boost {
  namespace histogram {
    namespace accumulators {
      template<typename RealType> class sum;
    }
  }
}
namespace boost {
  namespace histogram {
    namespace algorithm {
      template<typename A, typename S> auto sum(const histogram< A, S > &);
    }
  }
}
namespace boost {
  namespace histogram {
    namespace accumulators {
      template<typename T> class thread_safe;
    }
  }
}
namespace boost {
  namespace histogram {
    namespace accumulators {
      template<typename RealType> class weighted_mean;
    }
  }
}
namespace boost {
  namespace histogram {
    namespace accumulators {
      template<typename RealType> class weighted_sum;
    }
  }
}

Includes all algorithm headers of the Boost.Histogram library.

namespace boost {
  namespace histogram {
    namespace algorithm {
      template<typename A, typename S> 
        auto empty(const histogram< A, S > &, coverage);
    }
  }
}
namespace boost {
  namespace histogram {
    namespace algorithm {
      template<typename A, typename S, unsigned N, typename... Ns> 
        auto project(const histogram< A, S > &, 
                     std::integral_constant< unsigned, N >, Ns...);
      template<typename A, typename S, typename Iterable> 
        auto project(const histogram< A, S > &, const Iterable &);
    }
  }
}
namespace boost {
  namespace histogram {
    namespace algorithm {
      typedef unspecified reduce_option;
      reduce_option shrink_and_rebin(unsigned, double, double, unsigned);
      reduce_option 
      slice_and_rebin(unsigned, axis::index_type, axis::index_type, unsigned);
      reduce_option shrink(unsigned, double, double);
      reduce_option slice(unsigned, axis::index_type, axis::index_type);
      reduce_option rebin(unsigned, unsigned);
      reduce_option shrink_and_rebin(double, double, unsigned);
      reduce_option 
      slice_and_rebin(axis::index_type, axis::index_type, unsigned);
      reduce_option shrink(double, double);
      reduce_option slice(axis::index_type, axis::index_type);
      reduce_option rebin(unsigned);
      template<typename Histogram, typename Iterable> 
        decltype(auto) reduce(const Histogram &, const Iterable &);
      template<typename Histogram, class... Ts> 
        decltype(auto) 
        reduce(const Histogram &, const reduce_option &, const Ts &...);
    }
  }
}

Includes all axis headers of the Boost.Histogram library.

Extra header not automatically included:

namespace boost {
  namespace histogram {
    namespace axis {
      template<typename Value, typename MetaData, typename Options, 
               typename Allocator> 
        class category;
    }
  }
}
namespace boost {
  namespace histogram {
    namespace axis {
      template<typename Value, typename MetaData, typename Options> class integer;
    }
  }
}
namespace boost {
  namespace histogram {
    namespace axis {
      template<typename Axis> class interval_view;
    }
  }
}
namespace boost {
  namespace histogram {
    namespace axis {
      template<typename Derived> class iterator_mixin;
    }
  }
}
namespace boost {
  namespace histogram {
    namespace axis {
      template<typename Metadata, 
               typename DetailMetadata = detail::replace_default<Metadata, std::string> > 
        class metadata_base;
    }
  }
}

Options for builtin axis types.

Options circular and growth are mutually exclusive. Options circular and underflow are mutually exclusive.

namespace boost {
  namespace histogram {
    namespace axis {
      namespace option {
        template<unsigned Pos> struct bit;
        template<unsigned Bits> struct bitset;

        typedef bitset< 0 > none_t;  // All options off. 
        typedef bit< 0 > underflow_t;  // Axis has an underflow bin. Mutually exclusive with circular. 
        typedef bit< 1 > overflow_t;  // Axis has overflow bin. 
        typedef bit< 2 > circular_t;  // Axis is circular. Mutually exclusive with growth and underflow. 
        typedef bit< 3 > growth_t;  // Axis can grow. Mutually exclusive with circular. 

        constexpr none_t none;        // Instance of none_t. 
        constexpr underflow_t underflow;        // Instance of underflow_t. 
        constexpr overflow_t overflow;        // Instance of overflow_t. 
        constexpr circular_t circular;        // Instance of circular_t. 
        constexpr growth_t growth;        // Instance of growth_t. 

        // Set union of the axis option arguments. 
        template<unsigned B1, unsigned B2> 
          constexpr auto operator|(bitset< B1 >, bitset< B2 >);

        // Set intersection of the option arguments. 
        template<unsigned B1, unsigned B2> 
          constexpr auto operator&(bitset< B1 >, bitset< B2 >);

        // Set difference of the option arguments. 
        template<unsigned B1, unsigned B2> 
          constexpr auto operator-(bitset< B1 >, bitset< B2 >);
      }
    }
  }
}
namespace boost {
  namespace histogram {
    namespace axis {
      template<typename RealType> class polymorphic_bin;
    }
  }
}
namespace boost {
  namespace histogram {
    namespace axis {
      template<typename Value = double, typename MetaData = use_default, 
               typename Options = use_default> 
        class circular;
      template<typename Value, typename Transform, typename MetaData, 
               typename Options> 
        class regular;

      // Helper function to mark argument as step size. 
      template<typename T> step_type< T > step(T t);
      namespace transform {
        struct id;
        struct log;
        struct pow;
        struct sqrt;
      }
    }
  }
}
namespace boost {
  namespace histogram {
    namespace axis {
      namespace traits {
        template<typename Axis> struct is_continuous;
        template<typename Axis> struct is_reducible;
        template<typename Axis> struct static_is_inclusive;
        template<typename Axis> struct static_options;
        template<typename Axis> struct value_type;
        template<typename Axis> constexpr unsigned options(const Axis &);
        template<typename Axis> constexpr bool inclusive(const Axis &);
        template<typename Axis> index_type extent(const Axis &);
        template<typename Axis> decltype(auto) metadata(Axis &&);
        template<typename Axis> 
          decltype(auto) value(const Axis &, real_index_type);
        template<typename Result, typename Axis> 
          Result value_as(const Axis &, real_index_type);
        template<typename Axis, typename U> 
          axis::index_type index(const Axis &, const U &);
        template<typename Axis> constexpr unsigned rank(const Axis &);
        template<typename Axis, typename U> 
          std::pair< index_type, index_type > update(Axis &, const U &);
        template<typename Axis> decltype(auto) width(const Axis &, index_type);
        template<typename Result, typename Axis> 
          Result width_as(const Axis &, index_type);
      }
    }
  }
}
namespace boost {
  namespace histogram {
    namespace axis {
      template<typename Value, typename MetaData, typename Options, 
               typename Allocator> 
        class variable;
    }
  }
}
namespace boost {
  namespace histogram {
    namespace axis {
      template<class... Ts> class variant;

      // Apply visitor to variant (reference). 
      template<typename Visitor, class... Us> 
        decltype(auto) visit(Visitor && vis, variant< Us... > & var);

      // Apply visitor to variant (movable reference). 
      template<typename Visitor, class... Us> 
        decltype(auto) visit(Visitor && vis, variant< Us... > && var);

      // Apply visitor to variant (const reference). 
      template<typename Visitor, class... Us> 
        decltype(auto) visit(Visitor && vis, const variant< Us... > & var);

      // Returns pointer to T in variant or null pointer if type does not match. 
      template<typename T, class... Us> auto get_if(variant< Us... > * v);

      // Returns pointer to const T in variant or null pointer if type does not match. 
      template<typename T, class... Us> 
        auto get_if(const variant< Us... > * v);

      // Return reference to T, throws std::runtime_error if type does not match. 
      template<typename T, class... Us> 
        decltype(auto) get(variant< Us... > & v);

      // Return movable reference to T, throws unspecified exception if type does not match. 
      template<typename T, class... Us> 
        decltype(auto) get(variant< Us... > && v);

      // Return const reference to T, throws unspecified exception if type does not match. 
      template<typename T, class... Us> 
        decltype(auto) get(const variant< Us... > & v);
    }
  }
}

Forward declarations, tag types and type aliases.

namespace boost {
  namespace histogram {
    typedef storage_adaptor< std::vector< T, A > > dense_storage;  // Vector-like storage for fast zero-overhead access to cells. 
    typedef unlimited_storage<> default_storage;  // Default storage, optimized for unweighted histograms. 
    typedef dense_storage< accumulators::weighted_sum<> > weight_storage;  // Dense storage which tracks sums of weights and a variance estimate. 
    typedef dense_storage< accumulators::mean<> > profile_storage;  // Dense storage which tracks means of samples in each cell. 
    typedef dense_storage< accumulators::weighted_mean<> > weighted_profile_storage;  // Dense storage which tracks means of weighted samples in each cell. 
    namespace axis {
      struct null_type;

      typedef int index_type;  // Integral type for axis indices. 
      typedef double real_index_type;  // Real type for axis indices. 
      typedef null_type empty_type;  // Another alias for an empty metadata type. 
    }
  }
}
namespace boost {
  namespace histogram {
    template<typename Histogram> class indexed_range;

    enum coverage;
    template<typename Histogram> 
      auto indexed(Histogram &&, coverage = coverage::inner);
  }
}
namespace boost {
  namespace histogram {
    namespace literals {

      // Suffix operator to generate literal compile-time numbers, 0_c, 12_c, etc. 
      template<char... digits> auto operator""_c();
    }
  }
}

Collection of factory functions to conveniently create histograms.

namespace boost {
  namespace histogram {
    template<typename Storage, typename Axis, class... Axes> 
      auto make_histogram_with(Storage &&, Axis &&, Axes &&...);
    template<typename Axis, class... Axes> 
      auto make_histogram(Axis &&, Axes &&...);
    template<typename Axis, class... Axes> 
      auto make_weighted_histogram(Axis &&, Axes &&...);
    template<typename Storage, typename Iterable> 
      auto make_histogram_with(Storage &&, Iterable &&);
    template<typename Iterable> auto make_histogram(Iterable &&);
    template<typename Iterable> auto make_weighted_histogram(Iterable &&);
    template<typename Storage, typename Iterator> 
      auto make_histogram_with(Storage &&, Iterator, Iterator);
    template<typename Iterator> auto make_histogram(Iterator, Iterator);
    template<typename Iterator> 
      auto make_weighted_histogram(Iterator, Iterator);
  }
}

Collection of factory functions to conveniently create profiles.

Profiles are histograms which accept an additional sample and compute the mean of the sample in each cell.

namespace boost {
  namespace histogram {
    template<typename Axis, typename... Axes> 
      auto make_profile(Axis &&, Axes &&...);
    template<typename Axis, typename... Axes> 
      auto make_weighted_profile(Axis &&, Axes &&...);
    template<typename Iterable> auto make_profile(Iterable &&);
    template<typename Iterable> auto make_weighted_profile(Iterable &&);
    template<typename Iterator> auto make_profile(Iterator, Iterator);
    template<typename Iterator> auto make_weighted_profile(Iterator, Iterator);
  }
}

A simple streaming operator for the histogram type.

The text representation is rudimentary and not guaranteed to be stable between versions of Boost.Histogram. This header is not included by any other header and must be explicitly included to use the streaming operator.

To you use your own, simply include your own implementation instead of this header.

Simple streaming operators for the builtin accumulator types.

The text representation is not guaranteed to be stable between versions of Boost.Histogram. This header is only included by boost/histogram/ostream.hpp. To you use your own, include your own implementation instead of this header and do not include boost/histogram/ostream.hpp.

Simple streaming operators for the builtin axis types.

The text representation is not guaranteed to be stable between versions of Boost.Histogram. This header is only included by boost/histogram/ostream.hpp. To you use your own, include your own implementation instead of this header and do not include boost/histogram/ostream.hpp.

namespace boost {
  namespace histogram {
    template<class... Ts> auto sample(Ts &&...);
  }
}

Headers from Boost.Serialization needed to serialize STL types that are used internally by the Boost.Histogram classes.

namespace boost {
  namespace histogram {
    template<typename T> class storage_adaptor;
  }
}
namespace boost {
  namespace histogram {
    template<typename Allocator> class unlimited_storage;
  }
}
namespace boost {
  namespace histogram {
    struct unsafe_access;
  }
}
namespace boost {
  namespace histogram {
    template<typename T> struct weight_type;
    template<typename T> auto weight(T &&);
  }
}

PrevUpHomeNext