Skip to content

CPP Header Reference

The page is a huge overview of the C++ API at a high level without getting into too much of the nuts and bolts.

std::Containers

<array>

  • <array> - Arrays are fixed-size sequence containers: they hold a specific number of elements ordered in a strict linear sequence.
    • template < class T, size_t N > class array

<deque>

  • <deque> - deque (usually pronounced like “deck”) is an irregular acronym of double-ended queue. Double-ended queues are sequence containers with dynamic sizes that can be expanded or contracted on both ends (either its front or its back).
    • template < class T, class Alloc = allocator<T> > class deque

<forward_list>

  • <forward_list> - Forward lists are sequence containers that allow constant time insert and erase operations anywhere within the sequence.
    • template < class T, class Alloc = allocator<T> > class forward_list

<list>

  • <list> - Lists are sequence containers that allow constant time insert and erase operations anywhere within the sequence, and iteration in both directions.
    • template < class T, class Alloc = allocator<T> > class list

<map>

  • <map> - Maps are associative containers that store elements formed by a combination of a key value and a mapped value, following a specific order.
    • template < class Key, // map::key_type class T, // map::mapped_type class Compare = less<Key>, // map::key_compare class Alloc = allocator<pair<const Key,T> > // map::allocator_type> class map
  • <map> multimap - Multimaps are associative containers that store elements formed by a combination of a key value and a mapped value, following a specific order, and where multiple elements can have equivalent keys.
    • template < class Key,// multimap::key_type class T,// multimap::mapped_type class Compare = less<Key>, // multimap::key_compare class Alloc = allocator<pair<const Key,T> >// multimap::allocator_type> class multimap

<queue>

  • <queue> - queues are a type of container adaptor, specifically designed to operate in a FIFO context (first-in first-out), where elements are inserted into one end of the container and extracted from the other.
    • template <class T, class Container = deque<T> > class queue;
  • <queue> priority_queue - Priority queues are a type of container adaptors, specifically designed such that its first element is always the greatest of the elements it contains, according to some strict weak ordering criterion.
    • template <class T, class Container = vector<T>, class Compare = less<typename Container::value_type> > class priority_queue;

<set>

  • <set> - Sets are containers that store unique elements following a specific order.
    • template < class T,// set::key_type/value_type class Compare = less<T>, // set::key_compare/value_compare class Alloc = allocator<T>// set::allocator_type> class set
  • <set> multiset - Multisets are containers that store elements following a specific order, and where multiple elements can have equivalent values.
    • template < class T, // multiset::key_type/value_type class Compare = less<T>,// multiset::key_compare/value_compare

<stack>

  • <stack> - Stacks are a type of container adaptor, specifically designed to operate in a LIFO context (last-in first-out), where elements are inserted and extracted only from one end of the container.
    • template <class T, class Container = deque<T> > class stack

<unordered_map>

  • <unordered_map> - Unordered maps are associative containers that store elements formed by the combination of a key value and a mapped value, and which allows for fast retrieval of individual elements based on their keys.
    • template < class Key,// unordered_map::key_type class T, // unordered_map::mapped_type class Hash = hash<Key>, // unordered_map::hasher class Pred = equal_to<Key>, // unordered_map::key_equal class Alloc = allocator< pair<const Key,T> > // unordered_map::allocator_type> class unordered_map
  • <unordered_map> : unordered_multimap - Unordered multimaps are associative containers that store elements formed by the combination of a key value and a mapped value, much like unordered_map containers, but allowing different elements to have equivalent keys.
    • template < class Key,// unordered_multimap::key_type class T, // unordered_multimap::mapped_type class Hash = hash<Key>, // unordered_multimap::hasher class Pred = equal_to<Key>, // unordered_multimap::key_equal class Alloc = allocator< pair<const Key,T> > // unordered_multimap::allocator_type> class unordered_multimap

<unordered_set>

  • <unordered_set> - Unordered sets are containers that store unique elements in no particular order, and which allow for fast retrieval of individual elements based on their value.
    • template < class Key, // unordered_set::key_type/value_type class Hash = hash<Key>, // unordered_set::hasher class Pred = equal_to<Key>, // unordered_set::key_equal class Alloc = allocator<Key>// unordered_set::allocator_type> class unordered_set
  • <unordered_set> : unordered_multiset - Unordered multisets are containers that store elements in no particular order, allowing fast retrieval of individual elements based on their value, much like unordered_set containers, but allowing different elements to have equivalent values.
    • template < class Key, // unordered_multiset::key_type/value_type class Hash = hash<Key>,// unordered_multiset::hasher class Pred = equal_to<Key>,// unordered_multiset::key_equal class Alloc = allocator<Key>// unordered_multiset::allocator_type> class unordered_multiset

<vector>

  • <vector> - Vectors are sequence containers representing arrays that can change in size.
    • template < class T, class Alloc = allocator<T> > class vector; // generic template
  • <vector> : vector<bool> -This is a specialized version of vector, which is used for elements of type bool and optimizes for space.
    • template < class T, class Alloc = allocator<T> > class vector; // generic templatetemplate <class Alloc> class vector<bool,Alloc>; // bool specialization

std::Input/Output

<fstream>

Classes

Narrow characters (char)
  • <fstream> : ifstream - Input stream class to operate on files.
    • typedef basic_ifstream<char> ifstream
  • <fstream> : ofstream - Output stream class to operate on files.
    • typedef basic_ofstream<char> ofstream
  • <fstream> : fstream - Input/output stream class to operate on files.
    • typedef basic_fstream<char> fstream
  • <fstream> : filebuf - Stream buffer to read from and write to files.
    • typedef basic_filebuf<char> filebuf
Wide characters (wchar_t)
  • wifstream - Input stream class to operate on files using wide characters.
    • typedef basic_ifstream<wchar_t> wifstream
  • wofstream - Output stream class to operate on files using wide characters.
    • typedef basic_ofstream<wchar_t> wofstream
  • wfstream - Input/output stream class to operate on files using wide characters.
    • typedef basic_fstream<wchar_t> wfstream
  • wfilebuf - Stream buffer to read from and write to files using wide characters.
    • typedef basic_filebuf<wchar_t> wfilebuf

<iomanip>

Parametric manipulators

  • setiosflags - Sets the format flags specified by parameter mask.
  • resetiosflags - Unsets the format flags specified by parameter mask.
  • setbase - Sets the basefield to one of its possible values: dec, hex or oct, according to argument base.
  • setfill - Sets c as the stream’s fill character.
  • setprecision - Sets the decimal precision to be used to format floating-point values on output operations.
  • setw - Sets the field width to be used on output operations.
  • get_money - Extracts characters from the input stream it is applied to, and interprets them as a monetary expression, which is stored as the value of mon.
  • put_money - Inserts the representation of mon as a monetary value into the output stream it is applied to.
  • get_time - Extracts characters from the input stream it is applied to, and interprets them as time and date information as specified in argument fmt. The obtained data is stored at the struct tm object pointed by tmb.
  • put_time - Inserts the representation of the time and date information pointed by tmb, formatting it as specified by argument fmt.

<ios>

Class Templates

  • basic_ios - Template class to instantiate the base classes for all stream classes.
    • template <class charT, class traits = char_traits<charT> > class basic_ios
  • fpos - Class template used as a template for types to indicate positions in streams. The template depends on the state type stateT.
    • template <class stateT> class fpos

Classes

  • ios - Base class for all stream classes using narrow characters (of type char)
    • typedef basic_ios<char> ios
  • ios_base - Base class for the entire hierarchy of stream classes in the standard input/output library, describing the most basic part of a stream which is common to all stream objects, independently of their character type.
    • class ios_base
  • wios - This class is an instantiation of basic_ios designed to serve as base class for all wide stream classes, with wchar_t as character type (see basic_ios for more info on the template).
    • typedef basic_ios<wchar_t> ios

Other Types

<iosfwd>

  • iosfwd - This header provides forward declarations for the types of the standard input/output library.

<iostream>

Objects

Narrow characters (char)
  • cin - Object of class istream that represents the standard input stream oriented to narrow characters (of type char). It corresponds to the C stream stdin.
    • extern istream cin
  • cout - Object of class ostream that represents the standard output stream oriented to narrow characters (of type char). It corresponds to the C stream stdout.
    • extern ostream cout
  • cerr - Object of class ostream that represents the standard error stream oriented to narrow characters (of type char). It corresponds to the C stream stderr.
    • extern ostream cerr
  • clog - Object of class ostream that represents the standard logging stream oriented to narrow characters (of type char). It corresponds, along with cerr, to the _C stream) stderr.
    • extern ostream clog
Wide characters (wchar_t)
  • wcin - Object of class wistream that represents the standard input stream oriented to wide characters (of type wchar_t). It corresponds to the C stream stdin.
    • extern basic_istream<wchar_t> wcin
  • wcout - Object of class wostream that represents the _standard output stream) oriented to wide characters (of type wchar_t). It corresponds to the C stream stdout.
    • extern basic_ostream<wchar_t> wcout
  • wcerr - Object of class wostream that represents the standard error stream oriented to wide characters (of type wchar_t). It corresponds to the _C stream) stderr.
    • extern basic_ostream<wchar_t> wcerr
  • wclog - Object of class wostream that represents the standard logging stream oriented to wide characters (of type wchar_t). It corresponds, along with wcerr, to the C stream stderr.
    • extern basic_ostream<wchar_t> wclog

<istream>

Class Templates

Classes

Input manipulators (functions)

<ostream>

Class Templates

Classes

Input manipulators (functions)

<sstream>

Class Templates

Classes

Narrow characters (char)
Wide characters (wchar_t)

<streambuf>

Class Templates

Classes

std::Multi-threading

<atomic>

Classes

  • atomic - Objects of atomic types contain a value of a particular type (T).
    • template <class T> struct atomic
  • atomic_flag - Atomic flags are boolean atomic objects that support two operations: test-and-set and clear.
    • struct atomic_flag

Types

  • memory_order - Used as an argument to functions that conduct atomic operations to specify how other operations on different threads are synchronized.
    • enum memory_order

Functions

  • TODO

<condition_variable>

  • TODO

<future>

  • TODO

<mutex>

Classes

Mutexes
Locks
Other types

Functions

<thread>

Classes

  • thread - Class to represent individual threads of execution.
  • class thread
    • this_thread - This namespace groups a set of functions that access the current thread.