fn: std::vector.at

[contents]

Contents

Syntax

The syntax for std::vector.at calls is:

f++:  
name.at(index)
std::vector.at(name, index)

n++:  
@name.at(index)
@std::vector.at(name, index)

Description

The std::vector.at function takes two parameters with the first parameter being the name of a standard C++ vector variable and the second variable being a valid index, it returns the element at that index. As a member function it takes a single index parameter.

Note: For large scale projects you will find specifying the !mf option to not add member functions during definitions and using std::vector.at is faster than using the at member function.

f++ example

Example of std::vector.at being used with f++:

std::vector<double> v
v.push_back(2.0, 5.3, 3.26)
console(v.at(1))
console(std::vector.at(v, 2))

n++ example

Example of std::vector.at being used with n++:

@std::vector<double> v
@v.push_back(2.0, 5.3, 3.26)
@console(v.at(1))
@console(std::vector.at(v, 2))