yes but it sefaults if

i) both vectors are of equal size
ii) at least one of the pointers is NULL (and gets dereferenced by
std::equal)

I added the check if equal size to get _some_ protection from segfaults but
it will not protect against all silliness. We could go and check for null
pointers before but that seems rather too much involved to me for a ==
operator

On 17 February 2014 17:40, mcmenace <notifications@github.com> wrote:

> In src/openms/source/METADATA/SpectrumSettings.cpp:
>
> > @@ -108,7 +109,13 @@
> >             precursors_ == rhs.precursors_ &&
> >             products_ == rhs.products_ &&
> >             identification_ == rhs.identification_ &&
> > -           data_processing_ == rhs.data_processing_;
> > +           // We are not interested whether the pointers are equal but whether
> > +           // the contents are equal
> > +           // -- note this segfaults is somebody foolishly calls resize on the array ...
>
> Just looked at the code in detail. Why does this segfault? data_processing
> is a vector, so data_processing.size() should always work. Logical
> evaluation is from left to right, so if data_processing_.size() ==
> rhs.data_processing_.size() fails than std::equal(...) should not be
> evaluated, right?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/OpenMS/OpenMS/pull/695/files#r9797300>
> .
>