CGraph
Classes | Public Member Functions | Private Attributes | List of all members
USmallVector< T, CAPACITY > Class Template Reference

申请一块T类型的内存,封装为一个轻量级的std::vector使用 (主要为了减少内存占用?), 内部的迭代器也使用自定义的UIter More...

#include <USmallVector.h>

Inheritance diagram for USmallVector< T, CAPACITY >:
Inheritance graph
[legend]
Collaboration diagram for USmallVector< T, CAPACITY >:
Collaboration graph
[legend]

Classes

class  UIter
 

Public Member Functions

 USmallVector ()
 
 ~USmallVector () override
 
CVoid insert (const T &val, CBool isUnique=true)
 
CSize size () const
 
CBool empty () const
 
CVoid clear ()
 
CBool remove (const T &val)
 
CBool hasValue (const T &val) const
 
std::vector< T > asVector () const
 
UIter begin () const
 
UIter end () const
 
front () const
 
back () const
 
T & operator[] (CSize index)
 
const T & operator[] (CSize index) const
 
- Public Member Functions inherited from CObject
 CObject ()=default
 
virtual CStatus init ()
 
virtual CStatus destroy ()
 
virtual ~CObject ()=default
 

Private Attributes

T * data_ { nullptr }
 
CSize cur_index_ { 0 }
 
CSize capacity_ { 0 }
 

Additional Inherited Members

- Protected Member Functions inherited from UtilsObject
CStatus run () override
 

Detailed Description

template<class T, CSize CAPACITY = 8>
class USmallVector< T, CAPACITY >

申请一块T类型的内存,封装为一个轻量级的std::vector使用 (主要为了减少内存占用?), 内部的迭代器也使用自定义的UIter

Template Parameters
T
CAPACITY

Constructor & Destructor Documentation

◆ USmallVector()

template<class T , CSize CAPACITY = 8>
USmallVector< T, CAPACITY >::USmallVector ( )
inlineexplicit

◆ ~USmallVector()

template<class T , CSize CAPACITY = 8>
USmallVector< T, CAPACITY >::~USmallVector ( )
inlineoverride

Member Function Documentation

◆ asVector()

template<class T , CSize CAPACITY = 8>
std::vector<T> USmallVector< T, CAPACITY >::asVector ( ) const
inline

给vector赋值

Returns

◆ back()

template<class T , CSize CAPACITY = 8>
T USmallVector< T, CAPACITY >::back ( ) const
inline

◆ begin()

template<class T , CSize CAPACITY = 8>
UIter USmallVector< T, CAPACITY >::begin ( ) const
inline

◆ clear()

template<class T , CSize CAPACITY = 8>
CVoid USmallVector< T, CAPACITY >::clear ( )
inline

◆ empty()

template<class T , CSize CAPACITY = 8>
CBool USmallVector< T, CAPACITY >::empty ( ) const
inline

◆ end()

template<class T , CSize CAPACITY = 8>
UIter USmallVector< T, CAPACITY >::end ( ) const
inline

◆ front()

template<class T , CSize CAPACITY = 8>
T USmallVector< T, CAPACITY >::front ( ) const
inline

◆ hasValue()

template<class T , CSize CAPACITY = 8>
CBool USmallVector< T, CAPACITY >::hasValue ( const T &  val) const
inline

判断内部是否包含该值

Parameters
val
Returns

◆ insert()

template<class T , CSize CAPACITY = 8>
CVoid USmallVector< T, CAPACITY >::insert ( const T &  val,
CBool  isUnique = true 
)
inline

插入具体内容

Parameters
val
isUnique
Returns
Here is the call graph for this function:

◆ operator[]() [1/2]

template<class T , CSize CAPACITY = 8>
T& USmallVector< T, CAPACITY >::operator[] ( CSize  index)
inline

◆ operator[]() [2/2]

template<class T , CSize CAPACITY = 8>
const T& USmallVector< T, CAPACITY >::operator[] ( CSize  index) const
inline

◆ remove()

template<class T , CSize CAPACITY = 8>
CBool USmallVector< T, CAPACITY >::remove ( const T &  val)
inline

◆ size()

template<class T , CSize CAPACITY = 8>
CSize USmallVector< T, CAPACITY >::size ( ) const
inline

Member Data Documentation

◆ capacity_

template<class T , CSize CAPACITY = 8>
CSize USmallVector< T, CAPACITY >::capacity_ { 0 }
private

◆ cur_index_

template<class T , CSize CAPACITY = 8>
CSize USmallVector< T, CAPACITY >::cur_index_ { 0 }
private

◆ data_

template<class T , CSize CAPACITY = 8>
T* USmallVector< T, CAPACITY >::data_ { nullptr }
private

The documentation for this class was generated from the following file: