fn: std::vector.set

[contents]

Contents

Syntax

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

f++:  
name.set(index, param)
std::vector.set(name, index, param)

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

Description

The std::vector.set function takes three parameters specifying the name of a standard C++ vector variable, an index, and a value, it sets the element at the specified index to the specified value. As a member function it takes just the index and value parameters.

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

f++ example

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

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

n++ example

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

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

Sponsors