#include <SLFileList.hpp>
Collaboration diagram for SLFileList:
Public Member Functions | |
SLFileList (unsigned int initial_capacity) | |
const SLFile & | operator[] (unsigned int index) const |
void | push_back (const SLFile &file) |
unsigned int | size () const |
void | sort () |
Protected Attributes | |
boost::shared_ptr< Data > | _shared_ptr |
bool | _isSorted |
This class is optimized for fast copy by value.
Example of code :
#include "SLFileList.hpp" SLFileList list(100); // builds an empty list with initial capacity of 100 list.push_back(SLFile("/home/user/myfile")); SLFile dev = list[0]; // access 1st element of the list list[0] = SLFile("/home/user2/anotherfile"); // no pointer at all // no need to call delete anywhere
|
Build the list with an initial capacity. The initial_capacity allow to avoid frequent reallocations. |
|
The [] operator allow to read the list as it was an array.
|
|
This function works like std::vector. There is no memory allocation while the size of the list remains bellow the initial capacity. |
|
Gets the size of the list.
|
|
The list is unsorted by default. So this function does this work. Note: If called more than once, the sort done only one time. |
|
This variables is true after the 1st call to sort() |
|
This variable hold the various data used by the string in an efficient and memory leaks proof way. |