| 74 | /// Base class with a label |
| 75 | template <typename Allocator> |
| 76 | class labeled_base : public base { |
| 77 | public: |
| 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 | |
| 91 | protected: |
| 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 | |
| 102 | private: |
| 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. |
| 111 | template <typename Derived> |
nothing calls this directly
no outgoing calls
no test coverage detected