We marked array::sort
deprecated in favor of std::sort
.
Two issues:
We already (almost nicely) can use std::sort
: (tested with int-array)
std::sort(const_cast<int*>(arr.data()), const_cast<int*>(arr.data()) + arr.size());
This construct is not thread-safe! The array should be locked during the whole sorting operation, which is not possible that way.
Thus I recommend we de-deprecate array::sort
but replace it's implementation with the STL algorithm (but also using the collection's lock).
I changed (syntax, semantics, and implementation) of
array::sort
andfast_forward_list::sort
accordingly, to be fully compatible withstd::sort
. I also de-deprecated array, as suggested.One more idea:
array::begin()
,array::cbegin()
,array::end()
, andarray::cend()
by simply returning points to the array elements, as suggested above. These pointer are equivalent to random access iterators. It is not type-safe at all, but it would work.Opinions?
Last edit: SGrottel 2014-04-03