@@ -16,9 +16,7 @@ template <class T>
1616struct multi_weight_value : public boost ::span<T> {
1717 using boost::span<T>::span;
1818
19- void operator ()(const boost::span<T> values) {
20- operator +=(values);
21- }
19+ void operator ()(const boost::span<T> values) { operator +=(values); }
2220
2321 template <class S >
2422 bool operator ==(const S values) const {
@@ -29,18 +27,20 @@ struct multi_weight_value : public boost::span<T> {
2927 }
3028
3129 template <class S >
32- bool operator !=(const S values) const { return !operator ==(values); }
33-
34- // template <class S>
35- // void operator+=(const S values) {
36- // void operator+=(const std::vector<T> values) {
37- // if(values.size() != this->size())
38- // throw std::runtime_error("size does not match");
39- // auto it = this->begin();
40- // for(const T& x : values)
41- // *it++ += x;
42- // }
43- // void operator+=(const boost::span<T> values) {
30+ bool operator !=(const S values) const {
31+ return !operator ==(values);
32+ }
33+
34+ // template <class S>
35+ // void operator+=(const S values) {
36+ // void operator+=(const std::vector<T> values) {
37+ // if(values.size() != this->size())
38+ // throw std::runtime_error("size does not match");
39+ // auto it = this->begin();
40+ // for(const T& x : values)
41+ // *it++ += x;
42+ // }
43+ // void operator+=(const boost::span<T> values) {
4444 template <class S >
4545 void operator +=(const S values) {
4646 if (values.size () != this ->size ())
@@ -85,7 +85,10 @@ class multi_weight {
8585 : base_type{idx}
8686 , par_{par} {}
8787
88- decltype (auto ) operator *() const { return Reference{par_->buffer_ .get () + this ->base () * par_->nelem_ , par_->nelem_ }; }
88+ decltype (auto ) operator *() const {
89+ return Reference{par_->buffer_ .get () + this ->base () * par_->nelem_ ,
90+ par_->nelem_ };
91+ }
8992
9093 MWPtr par_ = nullptr ;
9194 };
@@ -99,9 +102,7 @@ class multi_weight {
99102 multi_weight (const std::size_t k = 0 )
100103 : nelem_{k} {}
101104
102- multi_weight (const multi_weight& other) {
103- *this = other;
104- }
105+ multi_weight (const multi_weight& other) { *this = other; }
105106
106107 multi_weight& operator =(const multi_weight& other) {
107108 nelem_ = other.nelem_ ;
@@ -114,7 +115,7 @@ class multi_weight {
114115 std::size_t size () const { return size_; }
115116
116117 void reset (std::size_t n) {
117- size_ = n;
118+ size_ = n;
118119 buffer_.reset (new element_type[size_ * nelem_]);
119120 default_fill ();
120121 }
@@ -135,8 +136,12 @@ class multi_weight {
135136 const_iterator begin () const { return {this , 0 }; }
136137 const_iterator end () const { return {this , size_}; }
137138
138- reference operator [](std::size_t i) { return reference{buffer_.get () + i * nelem_, nelem_}; }
139- const_reference operator [](std::size_t i) const { return const_reference{buffer_.get () + i * nelem_, nelem_}; }
139+ reference operator [](std::size_t i) {
140+ return reference{buffer_.get () + i * nelem_, nelem_};
141+ }
142+ const_reference operator [](std::size_t i) const {
143+ return const_reference{buffer_.get () + i * nelem_, nelem_};
144+ }
140145
141146 template <class T >
142147 bool operator ==(const multi_weight<T>& other) const {
@@ -177,8 +182,8 @@ class multi_weight {
177182 }
178183
179184 public:
180- std::size_t size_ = 0 ; // Number of bins
181- std::size_t nelem_ = 0 ; // Number of weights per bin
185+ std::size_t size_ = 0 ; // Number of bins
186+ std::size_t nelem_ = 0 ; // Number of weights per bin
182187 std::unique_ptr<element_type[]> buffer_;
183188};
184189
0 commit comments