chunkedseq
container library for large in-memory data sets
|
Type | Description |
---|---|
allocator_type | STL-style allocator class |
size_type | size_t |
value_type | type of items to be stored in the container |
reference | allocator_type::reference |
const_reference | allocator_type::const_reference |
pointer | allocator_type::pointer |
const_pointer | allocator_type::const_pointer |
Member | Description |
---|---|
capacity | integer value which denotes the maximum number items that can be contained in the chunk |
full() const | returns true iff the container is full (i.e., reached capacity) |
empty() const | returns true iff the container is empty |
size() const | returns the number of items in the container |
back() const | returns a reference to the last item in the container |
front() const | returns a reference to the first item in the container |
push_back(const value_type& x) | adds value x to the last position of the container |
push_front(const value_type& x) | adds value x to the first position of the container |
pop_back() | removes the value from the last position of the container |
pop_front() | removes the value from the first position of the container |
backn(value_type* xs, size_type nb) | copies the last nb items from the container to the memory pointed to by xs |
frontn(value_type* xs, size_type nb) | copies the first nb items from the container to the memory pointed to by xs |
pushn_back(const value_type* xs, size_type nb) | pushes on the back of the container the nb items from the memory pointed to by xs |
pushn_front(const value_type* xs, size_type nb) | pushes on the front of the container the nb items from the memory pointed to by xs |
pushn_back(const Body& body, size_type nb) | pushes on the back of the container nb uninitialized items (i.e., default-constructed items), then initializes each item i in the underlying vector vec by applying body(i, vec[i]) (behavior is undefined if size() + nb > capacity ) |
popn_front(size_type nb) | removes the first nb items from the container |
popn_back(size_type nb) | removes the last nb items from the container |
popn_front(value_type* xs, size_type nb) | removes the first nb items from the container and leaves the contents in the memory pointed to by xs |
popn_back(value_type* xs, size_type nb) | removes the last nb items from the container and leaves the contents in the memory pointed to by xs |
swap(Other_chunk& other) | swaps the contents of the chunk with the contents of another chunk of type Other_chunk |
transfer_back_to_front(chunk& target, size_type nb) | moves the last nb items from this chunk to the front of the target chunk |
transfer_front_to_back(chunk& target, size_type nb) | moves the first nb items from this chunk to the back of the target chunk |
get_vec() | returns a reference to the underlying vector container |
clear() | erases and deallocates the contents of the container |
operator[](size_type ix) const | returns a reference to the item at position ix in the container |
segment_by_index(size_type ix) const | returns the segment relative to the given index ix . in particular, the middle of the result segment points to the cell at index ix in the container and beginning and end point to the first and one past the last cell respectively that are both in the same contiguous chunk as the middle cell |
index_of_pointer(const value_type* p) const | returns the index in the sequence corresponding to pointer p |
The for-each loop operation offers sequential access to the items of a vector. To use the for-each loop, the client must apply the for_each
method of the vector, providing the body of the loop as the argument. If it accesses items read only, the body of the loop must provide the following method:
Member function | Description |
---|---|
operator()(reference v) | represents the action of the loop body to perform on the container item referenced by v |
c
int sum = 0; c.for_each([&sum] (reference v) { sum += v; });
This library provides two implementations of fixed-capacity vectors: the pasl::data::fixedcapacity::stack and the pasl::data::fixedcapacity::ringbuffer. Both export the same interface, namely the interface of the fixed-capacity vector, but each has different performance characteristics. The ringbuffer
offers slightly slower but still fast constant-time access to both ends of the container. The stack is biased to offer fast access to the end of the container. The disadvantage is that the stack imposes a linear-time cost to push an item on the front of the container. That is, the contents of the container must be shifted right by one position each time an individual item is pushed on the front of the container. However, the contents of the stack need to be shifted right by n positions in order to push n items in bulk at once.