52 #ifndef __PCL_SortedArray_h
53 #define __PCL_SortedArray_h
58 #include <pcl/Diagnostics.h>
81 template <
class T,
class A = StandardAllocator>
157 template <
typename T1>
186 return m_array.IsUnique();
196 return m_array.IsAliasOf( x.m_array );
208 m_array.EnsureUnique();
217 return m_array.Size();
225 return m_array.Length();
232 return m_array.Capacity();
239 return m_array.Available();
246 return m_array.IsValid();
253 return m_array.IsEmpty();
260 return m_array.LowerBound();
267 return m_array.UpperBound();
274 return m_array.Allocator();
281 m_array.SetAllocator( a );
288 return m_array.At( i );
295 return m_array.At( i );
302 return m_array.MutableIterator( i );
323 return m_array.ConstBegin();
330 return m_array.Begin();
337 return m_array.ConstEnd();
344 return m_array.End();
351 return m_array.ConstReverseBegin();
358 return m_array.ReverseBegin();
365 return m_array.ConstReverseEnd();
372 return m_array.ReverseEnd();
385 return m_array.UniquifyIterator( i );
399 return m_array.UniquifyIterators( i, j );
402 #ifndef __PCL_NO_STL_COMPATIBLE_ITERATORS
436 m_array.Assign( x.m_array );
452 m_array.Transfer( x.m_array );
459 m_array.Transfer( x.m_array );
490 m_array.Transfer( x );
498 m_array.Transfer( x );
506 m_array.Assign( v, n );
514 m_array.Assign( i, j );
522 m_array.Import( i, j );
530 return m_array.Release();
538 for (
iterator i = m_array.Begin(); i < m_array.End() && p < q; ++i )
540 i = m_array.Insert( i, *p++ );
542 m_array.Append( p, q );
566 m_array.EnsureUnique();
567 for (
iterator l = m_array.Begin(), r = m_array.End(); ; )
593 m_array.Remove(
const_cast<iterator>( i ), n );
614 m_array.RemoveFirst( n );
628 m_array.RemoveLast( n );
643 m_array.Truncate(
const_cast<iterator>( i ) );
675 m_array.Reserve( n );
730 return m_array.Count( v, p );
738 return m_array.CountIf( p );
760 return IsEmpty() ? End() : End()-1;
783 return m_array.Search( v, p );
798 return m_array.SearchLast( v, p );
805 return Search( v ) != End();
813 return Search( v, p ) != End();
837 return x1.m_array == x2.m_array;
846 return x1.m_array == x2;
855 return x1 == x2.m_array;
865 return x1.m_array < x2.m_array;
874 return x1.m_array < x2;
883 return x1 < x2.m_array;
902 template <
class S,
typename SP>
903 S& ToSeparated( S& s, SP separator )
const
905 return m_array.ToSeparated( s, separator );
930 template <
class S,
typename SP,
class AF>
931 S& ToSeparated( S& s, SP separator, AF append )
const
933 return m_array.ToSeparated( s, separator, append );
945 S& ToCommaSeparated( S& s )
const
947 return m_array.ToCommaSeparated( s );
959 S& ToSpaceSeparated( S& s )
const
961 return m_array.ToSpaceSeparated( s );
973 S& ToTabSeparated( S& s )
const
975 return m_array.ToTabSeparated( s );
987 S& ToNewLineSeparated( S& s )
const
989 return m_array.ToNewLineSeparated( s );
1002 return m_array.Hash64( seed );
1015 return m_array.Hash32( seed );
1031 array_implementation m_array;
1044 template <
class T,
class A,
class V>
inline
1045 SortedArray<T,A>&
operator <<( SortedArray<T,A>& x,
const V& v )
1059 template <
class T,
class A,
class V>
inline
1060 SortedArray<T,A>&
operator <<( SortedArray<T,A>&& x,
const V& v )
1071 template <
class T,
class A>
inline
1072 SortedArray<T,A>&
operator <<( SortedArray<T,A>& x1,
const SortedArray<T,A>& x2 )
1083 template <
class T,
class A>
inline
1084 SortedArray<T,A>&
operator <<( SortedArray<T,A>&& x1,
const SortedArray<T,A>& x2 )
1095 template <
class T,
class A>
inline
1096 SortedArray<T,A>&
operator <<( SortedArray<T,A>& x1,
const Array<T,A>& x2 )
1107 template <
class T,
class A>
inline
1108 SortedArray<T,A>&
operator <<( SortedArray<T,A>&& x1,
const Array<T,A>& x2 )
Provides memory allocation for PCL containers.
Root base class of all PCL sorted containers of objects.
Reverse random access iterator.
Generic dynamic sorted array.
void Shrink(size_type n=1)
SortedArray(const SortedArray &)=default
SortedArray(size_type n, const T &v)
const_reverse_iterator ReverseBegin() const
typename array_implementation::block_allocator block_allocator
void UniquifyIterator(iterator &i)
SortedArray(SortedArray &&)=default
const allocator & Allocator() const
const_iterator SearchLast(const T &v, BP p) const
friend void Swap(SortedArray &x1, SortedArray &x2)
typename array_implementation::allocator allocator
const_reverse_iterator ReverseEnd() const
bool Contains(const T &v, BP p) const
uint32 Hash32(uint32 seed=0) const
void Assign(const SortedArray &x)
const_iterator End() const
void Transfer(array_implementation &&x)
void UniquifyIterators(iterator &i, iterator &j)
const_iterator begin() const
typename array_implementation::const_iterator const_iterator
size_type UpperBound() const
const_iterator At(size_type i) const
size_type LowerBound() const
void Assign(const array_implementation &x)
void Transfer(SortedArray &&x)
void Add(const SortedArray &x)
const_iterator Search(const T &v) const
iterator MutableAt(size_type i)
void SetAllocator(const allocator &a)
void Truncate(const_iterator i)
size_type Available() const
typename array_implementation::reverse_iterator reverse_iterator
const_iterator MaxItem() const
void Remove(const_iterator i, size_type n=1)
const_iterator Search(const T &v, BP p) const
reverse_iterator MutableReverseBegin()
void RemoveFirst(size_type n=1)
const_iterator FirstThat(F f) const
size_type CountIf(UP p) const
typename array_implementation::const_reverse_iterator const_reverse_iterator
const_iterator SearchLast(const T &v) const
void Assign(const T &v, size_type n=1)
bool IsAliasOf(const SortedArray &x) const
void Add(const Array< T, A > &x)
const_iterator Begin() const
void Transfer(SortedArray &x)
size_type Count(const T &v) const
const_iterator Add(const T &v, size_type n=1)
uint64 Hash(uint64 seed=0) const
void Transfer(array_implementation &x)
reverse_iterator MutableReverseEnd()
void Reserve(size_type n)
const_iterator LastThat(F f) const
const_iterator end() const
uint64 Hash64(uint64 seed=0) const
const_iterator MinItem() const
void Import(iterator i, iterator j)
const_iterator MaxItem(BP p) const
iterator MutableIterator(const_iterator i)
typename array_implementation::iterator iterator
bool Contains(const T &v) const
void Remove(const_iterator i, const_iterator j)
void RemoveLast(size_type n=1)
size_type Count(const T &v, BP p) const
const_iterator MinItem(BP p) const
size_type Capacity() const
SortedArray(std::initializer_list< T1 > l)
Array< T, A > & operator<<(Array< T, A > &x, const V &v)
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
bool operator<(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
Complex< T1 > operator*(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
uint64 Hash64(const void *data, size_type size, uint64 seed=0) noexcept
void Swap(GenericPoint< T > &p1, GenericPoint< T > &p2) noexcept
unsigned long long uint64
FI BinarySearch(FI i, FI j, const T &v) noexcept
FI BinarySearchLast(FI i, FI j, const T &v) noexcept
FI1 Search(FI1 i1, FI1 j1, FI2 i2, FI2 j2) noexcept
FI InsertionPoint(FI i, FI j, const T &v) noexcept
BI LastThat(BI i, BI j, UP p) noexcept(noexcept(p))
FI MinItem(FI i, FI j) noexcept
FI MaxItem(FI i, FI j) noexcept
void Apply(FI i, FI j, F f) noexcept(noexcept(f))
FI FirstThat(FI i, FI j, UP p) noexcept(noexcept(p))