...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::histogram::axis::variant — Polymorphic axis type.
// 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); };
variant
public
construct/copy/destructvariant() = default;
variant(const variant &) = default;
variant(variant &&) = default;
template<typename T> variant(T && t);
template<class... Us> variant(const variant< Us... > & u);
variant & operator=(const variant &) = default;
variant & operator=(variant &&) = default;
template<typename T> variant & operator=(T && t);
template<class... Us> variant & operator=(const variant< Us... > & u);
variant
public member functionsindex_type size() const;Return size of axis.
unsigned options() const;Return options of axis or option::none_t if axis has no options.
bool inclusive() const;Returns true if the axis is inclusive or false.
bool ordered() const;Returns true if the axis is ordered or false.
bool continuous() const;Returns true if the axis is continuous or false.
metadata_type & metadata() const;Return reference to const metadata or instance of
null_type
if axis has no metadata.metadata_type & metadata();Return reference to metadata or instance of
null_type
if axis has no metadata.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.
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().
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().
template<typename Archive> void serialize(Archive & ar, unsigned);