std::vector::begin

iterator begin(); const_iterator begin() const; const_iterator cbegin() const; (since C++11) Returns an iterator to the first element of the container. If the container is empty, the returned iterator will be equal to end(). Parameters (none). Return value Iterator to the first element. Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Constant. Example See also end cend returns an iterator to the end (publ

std::vector::back

reference back(); const_reference back() const; Returns reference to the last element in the container. Calling back on an empty container is undefined. Parameters (none). Return value Reference to the last element. Complexity Constant. Notes For a container c, the expression return c.back(); is equivalent to { auto tmp = c.end(); --tmp; return *tmp; } Example The following code uses back to display the last element of a std::vector<char>: #include <vector

std::vector::at

reference at( size_type pos ); const_reference at( size_type pos ) const; Returns a reference to the element at specified location pos, with bounds checking. If pos not within the range of the container, an exception of type std::out_of_range is thrown. Parameters pos - position of the element to return Return value Reference to the requested element. Exceptions std::out_of_range if !(pos < size()). Complexity Constant. See also operator[] acces

std::vector::assign

void assign( size_type count, const T& value ); (1) template< class InputIt > void assign( InputIt first, InputIt last ); (2) void assign( std::initializer_list<T> ilist ); (3) (since C++11) Replaces the contents of the container. 1) Replaces the contents with count copies of value value 2) Replaces the contents with copies of those in the range [first, last). This overload has the same effect as overload (1) if InputIt is an integral type. (until C++11) T

std::vector

Defined in header <vector> template< class T, class Allocator = std::allocator<T> > class vector; std::vector is a sequence container that encapsulates dynamic size arrays. The elements are stored contiguously, which means that elements can be accessed not only through iterators, but also using offsets on regular pointers to elements. This means that a pointer to an element of a vector may be passed to any function that expects a pointer to an element o

std::va_list

Defined in header <cstdarg> typedef /* unspecified */ va_list; va_list is a complete object type suitable for holding the information needed by the macros va_start, va_copy, va_arg, and va_end. If a va_list instance is created, passed to another function, and used via va_arg in that function, then any subsequent use in the calling function should be preceded by a call to va_end. It is legal to pass a pointer to a va_list object to another function and then use that object a

std::valarray::valarray

valarray(); (1) explicit valarray( std::size_t count ); (2) valarray( const T& val, std::size_t count ); (3) valarray( const T* vals, std::size_t count ); (4) valarray( const valarray& other ); (5) valarray( valarray&& other ); (6) (since C++11) valarray( const std::slice_array<T>& ); (7) valarray( const std::gslice_array<T>& ); (8) valarray( const std::mask_array<T>& ); (9) valarray( const std:

std::valarray::swap

void swap( valarray& other ); Swaps the contents with those of other. Parameters other - another valarray to swap the contents with Return value (none). Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11)

std::valarray::sum

T sum() const; Computes the sum of the elements. The function can be used only if operator+= is defined for type T. If the std::valarray is empty, the behavior is undefined. The order in which the elements are processed by this function is unspecified. Parameters (none). Return value The sum of the elements. Example #include <iostream> #include <valarray> int main() { std::valarray<int> a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; std::cout << a.sum(

std::valarray::size

std::size_t size() const; Returns the number of elements in the valarray. Parameters (none). Return value Number of elements in the valarray. Example See also resize changes the size of valarray (public member function)