fn: std::vector.size

[contents]

Contents

Syntax

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

f++:  
name.size()
std::vector.size(name)

n++:  
@name.size()
@std::vector.size(name)

Description

The std::vector.size function takes a single parameter specifying the name of a standard C++ vector variable, it returns the size of the vector. As a member function it takes zero parameters.

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

f++ example

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

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

n++ example

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

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