Vue d'ensemble
Exemples
Captures d'écrans
Comparaisons
Applications
Télécharger
Documentation
Bazaar
État et Feuille de route
Foire aux questions
Auteurs & licence
Forums
Financement de U++
Recherche sur ce site
Langue
français











SourceForge.net Logo



Cette page n'a pas encore été traduite. Voulez-vous traduire cela ?

 

Buffer

 

template <class T>

class Buffer : private Moveable< Buffer<T> > 

 

T    Type of elements stored in Buffer.

 

Buffer is a simple class used to manage a fixed size plain old C dynamically allocated vector of elements of a specified type. The size of the buffer is specified as a constructor parameter and it can be also reallocated with new size, while loosing all current data.

 

Buffer is a moveable type with pick (only) transfer semantics. Calling methods of picked Buffer is logic error with the exceptions of:

void Alloc(int size);

void Alloc(int size, const T& in);

void Clear();

void operator=(pick_ Buffer& v);

 

 

Constructor Detail

 

Buffer()

Constructs an empty buffer.

 


 

Buffer(size_t size)

Constructs the Buffer with a size number of elements.

T must have default constructor.

 


 

Buffer(size_t size, const T& init)

Constructs the Buffer initializing the size elements to the specified value init.

T must have default constructor.

 


 

Buffer(pick_ Buffer& v)

Pick constructor. Destroys source container v.

 


 

~Buffer()

Default destructor.

 

 

Public Member List

 

void operator=(pick_ Buffer& v)

Pick operator. Source buffer v is destroyed.

 


 

operator T*()

Returns a pointer to the first element of the Buffer or NULL if the Buffer is empty.

 


 

operator const T*() const

Returns a pointer to the first element of the Buffer or NULL if the Buffer is empty.

 


 

T *operator~()

Returns a pointer to the first element of the Buffer or NULL if the Buffer is empty.

 


 

const T *operator~() const

Returns a pointer to the first element of the Buffer or NULL if the Buffer is empty.

 


 

void Alloc(size_t size)

Clears the buffer and allocates it with the new size size. All current elements are lost.

T must have default constructor.

 


 

void Alloc(size_t size, const T& in)

Clears the buffer and allocates it with the new size size, using the initialization value in. All current elements are lost.

T must have deep copy constructor.

 


 

void Clear()

Clears the buffer to the same state as default constructor. All current elements are destroyed.

 

 

Cette page est aussi en english. Vous voulez nous aider ?