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 for the latest Boost documentation.
PrevUpHomeNext

Class template variant

boost::histogram::axis::variant — Polymorphic axis type.

Synopsis

// In header: <boost/histogram/axis/variant.hpp>

template<class... Ts> 
class variant :
  public boost::histogram::axis::iterator_mixin< variant< Ts... > >
{
public:
  // construct/copy/destruct
  variant() = default;
  variant(const variant &) = default;
  variant(variant &&) = default;
  template<typename T> variant(T &&);
  template<class... Us> variant(const variant< Us... > &);
  variant & operator=(const variant &) = default;
  variant & operator=(variant &&) = default;
  template<typename T> variant & operator=(T &&);
  template<class... Us> variant & operator=(const variant< Us... > &);

  // public member functions
  index_type size() const;
  unsigned options() const;
  bool inclusive() const;
  bool ordered() const;
  bool continuous() const;
  metadata_type & metadata() const;
  metadata_type & metadata();
  template<typename U> index_type index(const U &) const;
  double value(real_index_type) const;
  auto bin(index_type) const;
  template<typename Archive> void serialize(Archive &, unsigned);
};

Description

variant public construct/copy/destruct

  1. variant() = default;
  2. variant(const variant &) = default;
  3. variant(variant &&) = default;
  4. template<typename T> variant(T && t);
  5. template<class... Us> variant(const variant< Us... > & u);
  6. variant & operator=(const variant &) = default;
  7. variant & operator=(variant &&) = default;
  8. template<typename T> variant & operator=(T && t);
  9. template<class... Us> variant & operator=(const variant< Us... > & u);

variant public member functions

  1. index_type size() const;
    Return size of axis.
  2. unsigned options() const;
    Return options of axis or option::none_t if axis has no options.
  3. bool inclusive() const;
    Returns true if the axis is inclusive or false.
  4. bool ordered() const;
    Returns true if the axis is ordered or false.
  5. bool continuous() const;
    Returns true if the axis is continuous or false.
  6. metadata_type & metadata() const;
    Return reference to const metadata or instance of null_type if axis has no metadata.
  7. metadata_type & metadata();
    Return reference to metadata or instance of null_type if axis has no metadata.
  8. template<typename U> index_type index(const U & u) const;
    Return index for value argument.

    Throws std::invalid_argument if axis has incompatible call signature.

  9. double value(real_index_type idx) const;
    Return value for index argument.

    Only works for axes with value method that returns something convertible to double and will throw a runtime_error otherwise, see axis::traits::value().

  10. auto bin(index_type idx) const;
    Return bin for index argument.

    Only works for axes with value method that returns something convertible to double and will throw a runtime_error otherwise, see axis::traits::value().

  11. template<typename Archive> void serialize(Archive & ar, unsigned);

PrevUpHomeNext