TOP --> libjdl
Defines a simple vector container class.
This class does not own its objects.
Here is a simple example that shows how to use this class.
CJdlVector<int> v; for(int i=0;i<10;i++) { v[i] = i; cout << v[i] << endl; } // These are all the same. cout << v.GetNumItems() << endl; cout << v.Size() << endl; cout << v.Length() << endl;
public CJdlVector ( ) ;
Default constructor.
Assumes a default size of 8.
public CJdlVector ( uint size ) ;
Constructor.
size | The initial size. |
public CJdlVector ( const CJdlVector < T > & obj ) ;
Copy constructor.
obj | The object to copy from. |
public ~ CJdlVector ( ) ;
Destructor.
public void Clear ( ) ;
Clear the list.
public void Resize ( uint ) ;
Resize the list.
size | Maximum size of the new list. |
public void Copy ( const CJdlVector < T > & ) ;
Copy another list to this one.
public uint GetNumItems ( ) const ;
Return the number of items in the list.
public uint Length ( ) const ;
Return the number of items in the list.
public uint Size ( ) const ;
Return the number of items in the list.
public bool IsEmpty ( ) const ;
Is the list empty?
public uint MaxLength ( ) const ;
Return the maximum number of items that can be stored in the list.
public void Append ( T & obj ) ;
Append an item to the list.
If the list is not large enough, it is automatically increased to accomodate the new object.
obj | The object to append. |
public void Append ( const CJdlVector < T > & list ) ;
Append another list to the list.
If the list is not large enough, it is automatically increased to accomodate the new objects.
list | The list to append. |
public void InsertBefore ( uint idx , T & obj ) ;
Insert item before the specified item in the list.
idx | The index to insert before. |
obj | The object to append. |
public void InsertAfter ( uint idx , T & obj ) ;
Insert item after the specified item in the list.
idx | The index to insert before. |
obj | The object to append. |
public T & Get ( uint i ) const ;
Get the i-th item.
An assertion is raised if the index is out of bounds
i | The index. |
public T & operator [ ] ( uint i ) ;
Get the i-th item (lhs & rhs).
If the array is not large enough it is grown.
i | The index. |
public void Set ( uint i , T val ) ;
Set the i-th item. Grow the list if necessary.
i | The index. |
public CJdlVector < T > & operator = ( const CJdlVector < T > & obj ) ;
Copy operator.
obj | The object to copy. |
public CJdlVector < T > & operator += ( T & val ) ;
Append to the list.
val | The value to append. |
public void Grow ( uint sz ) ;
Grow the list to the specified size.
This is used internally by the append and set methods.
sz | The new size. |
This documentation was generated automatically by the ccdoc tool (version 0.7a).
Click here to submit a bug report or feature request.
Click here to return to the top of the page.