fn: std::vector.push_back

[contents]

Contents

Syntax

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

f++:  
name.push_back(items)
std::vector.push_back(name, items)

n++:  
@name.push_back(items)
@std::vector.push_back(name, items)

Description

The std::vector.push_back function is for pushing items on to the back of standard C++ vectors, it takes at least two parameters with the first parameter being the name of a standard C++ vector variable and the remainder of the parameters being items to push on the back. As a member function it takes at least one parameter, all of which should be items to push on the back.

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

f++ example

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

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

n++ example

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

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