ext/ | |
License | Copyright © 2007-2011, FreeBASIC Extended Library Development Group |
Macros | |
fbext_Array | This macro expands to the name of the fbext_Array type. |
fbext_Array_Declare | This macro expands to the definition of the fbext_Array class. |
ext. | A generic variable-length array. |
Construction/ | |
default constructor | Constructs an empty array (having zero elements). |
copy constructor | Constructs an array consisting of copies of the elements from another. |
repeat constructor | Constructs an array consisting of copies of the default value. |
repeat constructor | Constructs an array consisting of copies of an element value. |
ranged constructor | Constructs an array from a copy of a range of elements. |
destructor | Destroys the array. |
copy operator let | Copy assigns to the array from another. |
Capacity | |
Size | Gets the number of elements in the array. |
Capacity | Gets the maximum number of elements the array can store without requiring additional memory. |
Empty | Determines if the array contains elements or not. |
Reserve | Ensures that the capacity of the array is at least n. |
Resize | Changes the size of the array to newsize number of elements. |
Resize | Changes the size of the array to newsize number of elements |
Iterators | |
Begin | Gets an iterator to the element at the front of the array. |
cBegin | Gets an iterator to the element at the front of the array; the element in immutable. |
End_ | Gets an iterator to the element at the back of the array. |
cEnd | Gets an iterator to the element at the back of the array; the element is immutable. |
Elements | |
Front | Gets a pointer to the element at the front of the array. |
cFront | Gets a pointer to the element at the front of the array; the element is immutable. |
Back | Gets a pointer to the element at the back of the array. |
cBack | Gets a pointer to the element at the back of the array; the element is immutable. |
Index | Gets a pointer to the element at index n in the array. |
cIndex | Gets a pointer to the element at index n in the array; the element is immutable. |
Insertion/ | |
PushBack | Inserts an element value at the back of the array. |
PopBack | Erases the element at the back of the array. |
Insert | Inserts an element before a certain position in the array. |
Insert | Inserts a range of elements before a certain position in the array. |
Insert | Inserts a number of copies of an element value before a certain position in the array. |
Erase | Removes an element from the array. |
Erase | Removes a range of elements from the array. |
Clear | Removes all of the elements in the array. |
Miscellaneous | |
Swap_ | Swaps the contents of the array with another in constant time. |
Copyright © 2007-2011, FreeBASIC Extended Library Development Group
Distributed under the FreeBASIC Extended Library Group license. See accompanying file LICENSE.txt or copy at http://code.google.com
# define fbext_Array( targs_ ) fbext_TemplateID( Array, targs_, fbext_Array_DefaultTArgs() )
This macro expands to the name of the fbext_Array type. It expects a single parameter which is a sequence of template arguments, which are described below. Note that this is an unqualified name (no “ext.” prefix). elem 0: T_ - Element type stored in the array. elem 1: Allocator_ - Name of allocator template. If not specified, fbext_Allocator is used.
A generic variable-length array.
Construction/ | |
default constructor | Constructs an empty array (having zero elements). |
copy constructor | Constructs an array consisting of copies of the elements from another. |
repeat constructor | Constructs an array consisting of copies of the default value. |
repeat constructor | Constructs an array consisting of copies of an element value. |
ranged constructor | Constructs an array from a copy of a range of elements. |
destructor | Destroys the array. |
copy operator let | Copy assigns to the array from another. |
Capacity | |
Size | Gets the number of elements in the array. |
Capacity | Gets the maximum number of elements the array can store without requiring additional memory. |
Empty | Determines if the array contains elements or not. |
Reserve | Ensures that the capacity of the array is at least n. |
Resize | Changes the size of the array to newsize number of elements. |
Resize | Changes the size of the array to newsize number of elements |
Iterators | |
Begin | Gets an iterator to the element at the front of the array. |
cBegin | Gets an iterator to the element at the front of the array; the element in immutable. |
End_ | Gets an iterator to the element at the back of the array. |
cEnd | Gets an iterator to the element at the back of the array; the element is immutable. |
Elements | |
Front | Gets a pointer to the element at the front of the array. |
cFront | Gets a pointer to the element at the front of the array; the element is immutable. |
Back | Gets a pointer to the element at the back of the array. |
cBack | Gets a pointer to the element at the back of the array; the element is immutable. |
Index | Gets a pointer to the element at index n in the array. |
cIndex | Gets a pointer to the element at index n in the array; the element is immutable. |
Insertion/ | |
PushBack | Inserts an element value at the back of the array. |
PopBack | Erases the element at the back of the array. |
Insert | Inserts an element before a certain position in the array. |
Insert | Inserts a range of elements before a certain position in the array. |
Insert | Inserts a number of copies of an element value before a certain position in the array. |
Erase | Removes an element from the array. |
Erase | Removes a range of elements from the array. |
Clear | Removes all of the elements in the array. |
Miscellaneous | |
Swap_ | Swaps the contents of the array with another in constant time. |
declare sub Reserve ( byval n as SizeType )
Ensures that the capacity of the array is at least n. If n is greater than Capacity, then the storage is reallocated.
n | the requested minimum capacity. |
declare sub Resize ( byval newsize as SizeType, byref value as const fbext_TypeName( T_) )
Changes the size of the array to newsize number of elements
newsize | the requested new size. |
value | if newsize is greater than Size, the new elements are copied from this value. |
declare const function cIndex ( byval n as SizeType ) as const fbext_TypeName( T_) ptr
Gets a pointer to the element at index n in the array; the element is immutable.
n | the index of the elements to retrieve. |
Returns a pointer to the element. If n >= <Size>() then the behavior is undefined.
declare function Insert ( byval position as typeof(Iterator), byref value as const fbext_TypeName( T_) ) as typeof(Iterator)
Inserts an element before a certain position in the array.
position | an iterator to an element in the array; the new element will be added before this element. |
value | the value to add. |
Returns an iterator to the newly inserted element.
declare sub Insert ( byval position as typeof(Iterator), byval first as typeof(IteratorToConst), byval last as typeof(IteratorToConst) )
Inserts a range of elements before a certain position in the array.
position | an iterator to an element in the array; the new elements will be added before this element. |
first | an iterator to the beginning of a range of elements to add. |
last | an iterator to one-passed the last element of the range. |
declare sub Insert ( byval position as typeof(Iterator), byval n as SizeType, byref value as const fbext_TypeName( T_) )
Inserts a number of copies of an element value before a certain position in the array.
position | an iterator to an element in the array; the new elements will be added before this element. |
n | the number of copies to insert. |
x | the value to insert. |
declare function Erase ( byval first as typeof(Iterator), byval last as typeof(Iterator) ) as typeof(Iterator)
Removes a range of elements from the array.
first | an iterator to the first element to be removed. |
last | an iterator to one-passed the last element to be removed. |
Returns an iterator to the next element in the array, or `this.End_()` if there are no such elements.
This macro expands to the name of the fbext_Array type.
# define fbext_Array( targs_ ) fbext_TemplateID( Array, targs_, fbext_Array_DefaultTArgs() )
This macro expands to the definition of the fbext_Array class.
# macro fbext_Array_Declare( T_, Allocator_ )
Destroys the array.
declare destructor ( )
Gets the number of elements in the array.
declare const function Size ( ) as SizeType
Gets the maximum number of elements the array can store without requiring additional memory.
declare const function Capacity ( ) as SizeType
Determines if the array contains elements or not.
declare const function Empty ( ) as bool
Ensures that the capacity of the array is at least n.
declare sub Reserve ( byval n as SizeType )
Changes the size of the array to newsize number of elements.
declare sub Resize ( byval newsize as SizeType )
Gets an iterator to the element at the front of the array.
declare function Begin ( ) as typeof(Iterator)
Gets an iterator to the element at the front of the array; the element in immutable.
declare const function cBegin ( ) as typeof(IteratorToConst)
Gets an iterator to the element at the back of the array.
declare function End_ ( ) as typeof(Iterator)
Gets an iterator to the element at the back of the array; the element is immutable.
declare const function cEnd ( ) as typeof(IteratorToConst)
Gets a pointer to the element at the front of the array.
declare function Front ( ) as fbext_TypeName( T_) ptr
Gets a pointer to the element at the front of the array; the element is immutable.
declare const function cFront ( ) as const fbext_TypeName( T_) ptr
Gets a pointer to the element at the back of the array.
declare function Back ( ) as fbext_TypeName( T_) ptr
Gets a pointer to the element at the back of the array; the element is immutable.
declare const function cBack ( ) as const fbext_TypeName( T_) ptr
Gets a pointer to the element at index n in the array.
declare function Index ( byval n as SizeType ) as fbext_TypeName( T_) ptr
Gets a pointer to the element at index n in the array; the element is immutable.
declare const function cIndex ( byval n as SizeType ) as const fbext_TypeName( T_) ptr
Inserts an element value at the back of the array.
declare sub PushBack ( byref value as const fbext_TypeName( T_) )
Erases the element at the back of the array.
declare sub PopBack ( )
Inserts an element before a certain position in the array.
declare function Insert ( byval position as typeof(Iterator), byref value as const fbext_TypeName( T_) ) as typeof(Iterator)
Removes an element from the array.
declare function Erase ( byval position as typeof(Iterator) ) as typeof(Iterator)
Removes all of the elements in the array.
declare sub Clear ( )
Swaps the contents of the array with another in constant time.
declare sub Swap_ ( byref x as typeof( fbext_Array(( T_)( Allocator_)) ) )