Skip to content

Commit 64b9f5a

Browse files
got rid of unnecessary grow methods and commented-out lines
1 parent 51fe530 commit 64b9f5a

File tree

4 files changed

+3
-35
lines changed

4 files changed

+3
-35
lines changed

src/include/stir/Array.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -569,16 +569,6 @@ class Array<1, elemT> : public NumericVectorWithOffset<elemT, elemT>
569569

570570
inline const elemT& at(const BasicCoordinate<1, int>& c) const;
571571
//@}
572-
/*
573-
void set_initialise_with_zeros(bool iwz)
574-
{
575-
init_with_zeros_ = iwz;
576-
}
577-
bool get_initialise_with_zeros() const
578-
{
579-
return init_with_zeros_;
580-
}
581-
*/
582572
private:
583573
// Make sure we can call init() recursively.
584574
template <int num_dimensions2, class elemT2>
@@ -589,8 +579,6 @@ class Array<1, elemT> : public NumericVectorWithOffset<elemT, elemT>
589579
\arg data_ptr should start to a contiguous block of correct size
590580
*/
591581
inline void init(const IndexRange<1>& range, elemT* const data_ptr, bool copy_data);
592-
593-
// bool init_with_zeros_ = true;
594582
};
595583

596584
END_NAMESPACE_STIR

src/include/stir/Array.inl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,8 @@ Array<1, elemT>::resize(const int min_index, const int max_index, bool initialis
582582
const int oldstart = this->get_min_index();
583583
const size_type oldlength = this->size();
584584

585-
base_type::resize(min_index, max_index, initialise_with_0);
585+
base_type::resize(min_index, max_index);
586586

587-
// if (!get_initialise_with_zeros())
588587
if (!initialise_with_0)
589588
{
590589
this->check_state();

src/include/stir/VectorWithOffset.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ class VectorWithOffset
194194
resize() in a derived class, it is probably safest to overload
195195
grow() as well.
196196
*/
197-
inline virtual void grow(const int min_index, const int max_index, bool initialise_with_0);
198197
inline virtual void grow(const int min_index, const int max_index);
199198

200199
//! grow the range of the vector from 0 to new_size-1, new elements are set to \c T()
@@ -208,7 +207,6 @@ class VectorWithOffset
208207
\todo in principle reallocation could be avoided when the new range would fit in the
209208
old one by shifting.
210209
*/
211-
inline virtual void resize(const int min_index, const int max_index, bool initialise_with_0);
212210
inline virtual void resize(const int min_index, const int max_index);
213211

214212
//! change the range of the vector from 0 to new_size-1, new elements are set to \c T()

src/include/stir/VectorWithOffset.inl

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ VectorWithOffset<T>::reserve(const unsigned int new_size)
416416
// the new members will be initialised with the default constructor for T
417417
template <class T>
418418
void
419-
VectorWithOffset<T>::resize(const int min_index, const int max_index, bool initialise_with_0)
419+
VectorWithOffset<T>::resize(const int min_index, const int max_index)
420420
{
421421
this->check_state();
422422
if (min_index > max_index)
@@ -465,13 +465,6 @@ VectorWithOffset<T>::resize(const int min_index, const int max_index, bool initi
465465
this->check_state();
466466
}
467467

468-
template <class T>
469-
void
470-
VectorWithOffset<T>::resize(const int min_index, const int max_index)
471-
{
472-
resize(min_index, max_index, true);
473-
}
474-
475468
template <class T>
476469
void
477470
VectorWithOffset<T>::resize(const unsigned new_size)
@@ -486,21 +479,11 @@ VectorWithOffset<T>::resize(const unsigned new_size)
486479
this->resize(0, static_cast<int>(new_size - 1));
487480
}
488481

489-
// the new members will be initialised with the default constructor for T
490-
template <class T>
491-
void
492-
VectorWithOffset<T>::grow(const int min_index, const int max_index, bool initialise_with_0)
493-
{
494-
// allow grow arbitrary when it's zero length
495-
assert(length == 0 || (min_index <= this->get_min_index() && max_index >= this->get_max_index()));
496-
this->resize(min_index, max_index, initialise_with_0);
497-
}
498-
499482
template <class T>
500483
void
501484
VectorWithOffset<T>::grow(const int min_index, const int max_index)
502485
{
503-
this->grow(min_index, max_index, true);
486+
this->resize(min_index, max_index);
504487
}
505488

506489
template <class T>

0 commit comments

Comments
 (0)