MCPcopy Create free account
hub / github.com/boostorg/histogram / labeled_base

Class labeled_base

include/boost/histogram/axis/base.hpp:76–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74/// Base class with a label
75template <typename Allocator>
76class labeled_base : public base {
77public:
78 using allocator_type = Allocator;
79
80 allocator_type get_allocator() const { return label_.get_allocator(); }
81
82 /// Returns the axis label, which is a name or description.
83 boost::string_view label() const noexcept { return label_; }
84 /// Change the label of an axis.
85 void label(boost::string_view label) { label_.assign(label.begin(), label.end()); }
86
87 bool operator==(const labeled_base& rhs) const noexcept {
88 return base::operator==(rhs) && label_ == rhs.label_;
89 }
90
91protected:
92 labeled_base() = default;
93 labeled_base(const labeled_base&) = default;
94 labeled_base& operator=(const labeled_base&) = default;
95 labeled_base(labeled_base&& rhs) = default;
96 labeled_base& operator=(labeled_base&& rhs) = default;
97
98 labeled_base(unsigned size, axis::uoflow_type uo, string_view label,
99 const allocator_type& a)
100 : base(size, uo), label_(label.begin(), label.end(), a) {}
101
102private:
103 boost::container::basic_string<char, std::char_traits<char>, allocator_type> label_;
104
105 friend class ::boost::serialization::access;
106 template <class Archive>
107 void serialize(Archive&, unsigned);
108};
109
110/// Iterator mixin, uses CRTP to inject iterator logic into Derived.
111template <typename Derived>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected