57#ifndef __SmallVector_H
58#define __SmallVector_H
74 template<
class T1,
class T2>
75 inline _Scalar_ptr_iterator_tag _Ptr_cat(T1 **, T2 **) {
76 _Scalar_ptr_iterator_tag _Cat;
80 template<
class T1,
class T2>
81 inline _Scalar_ptr_iterator_tag _Ptr_cat(T1*
const *, T2 **) {
82 _Scalar_ptr_iterator_tag _Cat;
109 template <
typename T>
struct isPodLike<
T*> {
static const bool value =
true; };
111 template<
typename T,
typename U>
162 template <
typename T>
237 template <
typename T,
bool isPodLike>
251 template<
typename It1,
typename It2>
253 std::uninitialized_copy(
I,
E,
Dest);
262 template <
typename T,
bool isPodLike>
272 this->uninitialized_copy(this->begin(), this->end(),
NewElts);
275 destroy_range(this->begin(), this->end());
278 if (!this->isSmall())
289 template <
typename T>
299 template<
typename It1,
typename It2>
302 std::uninitialized_copy(
I,
E,
Dest);
307 template<
typename T1,
typename T2>
326 template <
typename T>
359 }
else if (
N > this->
size()) {
371 }
else if (
N > this->
size()) {
401 T Result = this->
back();
410 template<
typename in_iter>
432 std::uninitialized_fill_n(this->
end(), NumInputs,
Elt);
447 std::copy(
I+1, this->
end(), I);
464 if (
I == this->
end()) {
466 return this->
end()-1;
474 std::copy_backward(
I, this->
end()-1, this->
end());
480 I = this->
begin()+EltNo;
485 if (
I == this->
end()) {
487 return this->
end()-1;
494 reserve(
static_cast<unsigned>(this->
size() + NumToInsert));
497 I = this->
begin()+InsertElt;
531 template<
typename ItTy>
533 if (
I == this->
end()) {
535 return this->
end()-1;
543 reserve(
static_cast<unsigned>(this->
size() + NumToInsert));
546 I = this->
begin()+InsertElt;
587 if (this->
size() != RHS.
size())
return false;
591 return !(*
this ==
RHS);
595 return std::lexicographical_compare(this->
begin(), this->
end(),
621 template <
typename T>
623 if (
this == &
RHS)
return;
626 if (!this->isSmall() && !
RHS.isSmall()) {
632 if (
RHS.size() >
this->capacity())
633 this->grow(
RHS.size());
634 if (this->size() >
RHS.capacity())
635 RHS.grow(this->size());
640 for (
unsigned i = 0;
i !=
static_cast<unsigned>(
NumShared); ++
i)
644 if (this->size() >
RHS.size()) {
646 this->uninitialized_copy(this->begin()+
NumShared, this->end(),
RHS.end());
648 this->destroy_range(this->begin()+
NumShared, this->end());
650 }
else if (
RHS.size() >
this->size()) {
653 this->setEnd(this->end() +
EltDiff);
659 template <
typename T>
663 if (
this == &
RHS)
return *
this;
678 this->destroy_range(
NewEnd, this->end());
687 if (this->capacity() <
RHSSize) {
689 this->destroy_range(this->begin(), this->end());
690 this->setEnd(this->begin());
703 this->setEnd(this->begin()+
RHSSize);
716 template <
typename T,
unsigned N>
723 MinUs = (
static_cast<unsigned int>(
sizeof(
T))*
N +
724 static_cast<unsigned int>(
sizeof(
U)) - 1) /
725 static_cast<unsigned int>(
sizeof(
U)),
735 static_cast<unsigned int>(
sizeof(
T))
749 template<
typename ItTy>
781 template<
typename ItTy>
807 template<
typename T,
unsigned N>
Reference-counted shared pointer, used for objects where implicit destruction is required.
void swap(SharedPtr< T > &other)
SmallVectorBase - This is all the non-templated stuff common to all SmallVectors.
union Ogre::SmallVectorBase::U FirstEl
SmallVectorBase(size_t Size)
size_t size_in_bytes() const
size_in_bytes - This returns size()*sizeof(T).
bool isSmall() const
isSmall - Return true if this is a smallvector which has not had dynamic memory allocated for it.
size_t capacity_in_bytes() const
capacity_in_bytes - This returns capacity()*sizeof(T).
void grow_pod(size_t MinSizeInBytes, size_t TSize)
grow_pod - This is an implementation of the grow() method which only works
SmallVectorImpl - This class consists of common code factored out of the SmallVector class to reduce ...
SuperClass::size_type size_type
void push_back(const T &Elt)
bool operator!=(const SmallVectorImpl &RHS) const
void assign(unsigned NumElts, const T &Elt)
iterator erase(iterator S, iterator E)
iterator erase(iterator I)
iterator insert(iterator I, size_type NumToInsert, const T &Elt)
bool operator<(const SmallVectorImpl &RHS) const
const SmallVectorImpl & operator=(const SmallVectorImpl &RHS)
void resize(unsigned N, const T &NV)
void set_size(unsigned N)
set_size - Set the array size to
static void construct_range(T *S, T *E, const T &Elt)
SuperClass::iterator iterator
SmallVectorTemplateBase< T, isPodLike< T >::value > SuperClass
iterator insert(iterator I, const T &Elt)
bool operator==(const SmallVectorImpl &RHS) const
void append(in_iter in_start, in_iter in_end)
append - Add the specified range to the end of the SmallVector.
iterator insert(iterator I, ItTy From, ItTy To)
void swap(SmallVectorImpl &RHS)
void append(size_type NumInputs, const T &Elt)
append - Add the specified range to the end of the SmallVector.
SmallVectorImpl(unsigned N)
SmallVectorImpl(const SmallVectorImpl &)
static void uninitialized_copy(It1 I, It1 E, It2 Dest)
uninitialized_copy - Copy the range [I, E) onto the uninitialized memory starting with "Dest",...
void grow(size_t MinSize=0)
grow - double the size of the allocated memory, guaranteeing space for at least one more element or M...
SmallVectorTemplateBase(size_t Size)
static void uninitialized_copy(T1 *I, T1 *E, T2 *Dest)
uninitialized_copy - Copy the range [I, E) onto the uninitialized memory starting with "Dest",...
static void destroy_range(T *, T *)
SmallVectorTemplateBase<isPodLike = false> - This is where we put method implementations that are des...
static void destroy_range(T *S, T *E)
static void uninitialized_copy(It1 I, It1 E, It2 Dest)
uninitialized_copy - Copy the range [I, E) onto the uninitialized memory starting with "Dest",...
SmallVectorTemplateBase(size_t Size)
void grow(size_t MinSize=0)
grow - double the size of the allocated memory, guaranteeing space for at least one more element or M...
const_pointer data() const
data - Return a pointer to the vector's buffer, even if empty().
SmallVectorTemplateCommon(size_t Size)
pointer data()
data - Return a pointer to the vector's buffer, even if empty().
std::reverse_iterator< const_iterator > const_reverse_iterator
const_reverse_iterator rbegin() const
ptrdiff_t difference_type
const_reverse_iterator rend() const
const_reference front() const
const_iterator end() const
const_reference back() const
size_t capacity() const
capacity - Return the total number of elements in the currently allocated buffer.
size_type max_size() const
const_iterator begin() const
const_reference operator[](unsigned idx) const
reference operator[](unsigned idx)
reverse_iterator rbegin()
std::reverse_iterator< iterator > reverse_iterator
const T & const_reference
const_iterator capacity_ptr() const
SmallVector(ItTy S, ItTy E)
SmallVector & operator=(const SmallVectorImpl< T > &RHS)
SmallVector(const SmallVector &RHS)
SmallVector(unsigned Size, const T &Value=T())
SmallVector - This is a 'vector' (really, a variable-sized array), optimized for the case when the ar...
const SmallVector & operator=(const SmallVector &RHS)
SmallVector(ItTy S, ItTy E)
U InlineElts[NumInlineEltsElts]
SmallVectorImpl< T >::U U
InlineElts - These are 'N-1' elements that are stored inline in the body of the vector.
SmallVector(const SmallVector &RHS)
SmallVector(unsigned Size, const T &Value=T())
void swap(Ogre::SmallVectorImpl< T > &LHS, Ogre::SmallVectorImpl< T > &RHS)
Implement std::swap in terms of SmallVector swap.