C plus plus:Modern C plus plus:Glossary

From GPWiki
Jump to: navigation, search

Modern C++ : Going Beyond "C with Classes"

This is a limited glossary for terms related to this series of articles. The Wiki-wide Glossary has many more entries.

Aggregate

An aggregate is an array or a class with no user-declared constructors, no private or protected non-static data members, no base classes, and no virtual functions.

You can use initialiser list syntax like you would in C on aggregates only.

Amortized Complexity

Average complexity over a large number of calls.

For example, push_back on a std::vector is amortized O(1) because it occasionally needs an O(n) reallocation, but only once every n calls or so, with the rest being O(1). Since this means O(n) for n calls, the per-call complexity averages to O(1).

Fundamental Type

One of the basic types in the C++ language, such as int, unsigned char, double, bool, array, or pointer.

Note that structs and classes are not fundamental.

N-ary Function

A Function that takes N parameters.

Nullary Function

A Function that takes no arguments.

POD Type

Plain Old Data Type

All fundamental types are POD Types. structs ( or classes, since they're the same ) are POD if all their member types are POD types and they have the default, compiler-generated default constructor, copy constructor, assignment, and destructor. ( This implies that construction and destruction are NOPs and copying or assignment can be done with a bitwise copy. )

Unary Function

A Function that takes exactly one argument.