===========================================================================
STANDARD TEMPLATE LIBRARY
===========================================================================
Common Items:
Vector
Set/multiset
Map/multimap
List
set c VSML
set c(operator) SM
set c(c2) VSML
set c(n) V L
set c(n, elem) V L
set c(beg, end) VSML
set c(beg, end, op) SM
c.begin() VSML
c.end() VSML
c.rbegin() VSML
c.rend() VSML
c.size() VSML
c.empty() VSML
c.max_size() VSML
c.capacity() V
c.reserve() V
==, !=, <, >, <=, >= VSML
c1 = c2 VSML
c.assign(n,elem) V L
c.assign(beg,end) V L
c1.swap(c2) VSML
swap(c1,c2) VSML
c.front() V L
c.back() V L
c.push_back(elem) V L
void c.pop_back() V L
c.push_front(elem) L
void c.pop_front() L
c.insert(pos,elem) VSML
c.insert(pos,n,elem) V L
c.insert(pos,beg,end) V L
c.insert(elem) SM
c.insert(beg,end) SM
c.erase(elem) SM
c.erase(pos) VSML
c.erase(beg,end) VSML
c.resize(num) V L
c.resize(num,elem) V L
c.clear() VSML
Vector:
vec.at(idx)
vec[idx]
Set, Multiset:
set
set
c.begin()
c.end()
c.rbegin()
c.rend()
c.count(value)
c.find(value)
c.lower_bound(value)
c.upper_bound(value)
c.equal_range(value)
List:
li.sort() /* use instead of general sort */
li.remove(val)
li.remove_if(op)
li.unique() // removes consecutive duplicates
li.unique(op) // removes as above if op is true
li.splice(pos, li2)
li.splice(pos, li2, li2pos)
li.splice(pos, li2,, li2beg, li2end)
li.sort()
li.sort(op)
li.merge(li2)
li.merge(li2,op)
li.reverse
-----------
Map, Multimap:
map
map
m.begin()
m.end()
m.rbegin()
m.rend()
m.count(key)
m.find(key)
m.lower_bound(key)
m.upper_bound(key)
m.equal_range(key)
m[key]
For a key which does not exist, find() returns end(); upper_bound and
lower_bound are equal and return the place where it would be inserted (i.e.
the next highest value)
------------
Strings:
=, assign()
swap()
+=, append(), push_back()
insert()
erase()
clear()
resize()
replace()
==, !=, <, <=, >, >=, compare()
size(), length()
max_size()
empty()
capacity()
reserve()
[], at() at() checks bounds; [] trusts the user
copy()
c_str()
data()
substr()
begin(), end()
rbegin, rend()
get_allocator()
----------------------------------------
Stack:
s.empty()
s.size()
s.push()
s.top()
void s.pop()
and that's about it.
Queue:
q.empty()
q.size()
q.push()
q.front()
q.back()
void q.pop()
Priority Queue:
priority_queue
container type could be deque, vector, or anything with random access
(so no lists) and front(), push_back(), and pop_back().
Interface as normal queue.
Bitset:
----------------------------------------
Algorithms:
for_each (beg, end, op)
// Nonmodifying Algorithms:
count(beg, end, const &value) //counts items equal to val
count_if(beg, end, op)
min_element(beg, end)
min_element(beg, end, compfunc)
max_element(beg, end)
max_element(beg, end, compfunc)
find(beg, end, value)
find_if(beg, end, op)
search_n(beg, end, count, value [,op]) // finds n consec. matching elements
search(beg, end, searchbeg, searchend [,op]) // search for subrange
find_end(beg, end, searchbeg, searchend [,op]) //as above but finds LAST one
find_first_of(beg, end, searchbeg, searchend[,op]) // finds ANY, not all
adjacent_find(beg, end[,op]) // finds two adjacent equal thins
equal(beg, end, cmpbeg[,op])
mismatch(beg, end, cmpbeg[,op]) // returns first difference
lexicographical_compare(beg1, end1, beg2, end2 [,op])
// Modifying Algorithms:
copy(beg, end, destbeg)
copy_backward(beg, end, destend)
transform(beg, end, destbeg, unaryop) //copies, but calls op on each element
transform(beg, end, beg2, destbeg, binaryop)
swap_ranges(beg1, end1, beg2) //foo.swap is prefered when possible
fill(beg, end, value)
fill_n(beg, num, value)
generate(beg, end, op)
generate_n(beg, num, op)
replace(beg, end, oldvalue, newvalue)
replace_if(beg, end, op, newvalue)
replace_copy(beg, end, destbeg, oldvalue, newvalue)
replace_copy_if(beg, end, destbeg, op, newvalue)
// Removing Algorithms:
remove(beg, end, value) // doesn't actually remove, just moves to end
remove_if(beg, end, op)
remove_copy(beg, end, destbeg, value)
remove_copy_if(beg, end, destbeg, op)
unique(beg, end [,op])
unique_copy(beg, end, destbeg [,op])
// Mutating (reordering) Algorithms:
reverse(beg, end)
reverse_copy(beg, end, destbeg)
rotate(beg, newbeg, end)
rotate_copy(beg, newbeg, end, destbeg)
next_permutation(beg, end)
prev_permutation(beg, end)
random_shuffle(beg, end [,op])
partition(beg, end, op)
stable_partition(beg, end, op)
// Sorting Algorithms:
sort(beg, end [,op]) // can't use for lists; use list.sort()
stable_sort(beg, end [,op])
partial_sort(beg, sortend, end [,op])
partial_sort_copy(beg, end, destbeg, destend [,op])
nth_element(beg, nth, end [,op])
// Heap Algorithms:
make_heap(beg, end [,op])
push_heap(beg, end [,op]) // assuming beg to end-1 is heap, adds end
pop_heap(beg, end [,op]) // moves head to end; beg to end-1 is heap
sort_heap(beg, end [,op]) // not a heap anymore after this
// Sorted Range Algorithms (might work even on unsorted... or might not):
bool binary_search(beg, end, value [,op]) // checks existence only
bool includes(beg, end, searchbeg, searchend [,op]) // existence of all
lower_bound(beg, end, value [,op]) // first item <= value
upper_bound(beg, end, value [,op]) // first item > value
pair<..> equal_range(beg, end, value [,op]) // both of the above
merge(beg1, end1, beg2, end2, destbeg [,op])
set_union(beg1, end1, beg2, end2, destbeg [,op])
set_intersection(beg1, end1, beg2, end2, destbeg [,op])
set_difference(...) // set1 - set2
set_symmetric_difference(...) // like an xor
inplace_merge(beg1, end1beg2, end2 [,op])
// Numeric algorithms (include ):
accumulate(beg, end, initvalue [,sum_op])
inner_product(beg1, end2, beg2, initvalue [,sum_op, product_op])
partial_sum(beg, end, destbeg [,op])
adjacent_difference(beg, end, destbeg [,op])
----------------------------------------
Iterators:
Reverse iterators must be created with an explicit constructor.
They can be converted back to normal iterators with base()
TypeID
#include
// You cannot actually declare variables of type std::type_info - the
// constructor is private. You must save things to references.
const std::type_info& t = typeid(object-or-expression);
t.name(); // returns const char *
// Other than printing the name, comparing to others is all you can do.
// You can decode the name with c++filt
Functors:
unary:
negate
logical_not
binary:
plus
minus
multiplies
divides
modulus
equal_to
not_equal_to
less
greater
less_equal
greateR_equal
logical_and
logical_not
adapters:
bind1st(op, value) -> op(value, param)
bind2nd(op, value) -> op(param, value)
not1(op) -> !op(param)
not2(op) -> !op(param1, param2)
member function adapters:
mem_fun_ref(op)
mem_fun(op)
function pointer adapters:
ptr_fun(op)
Note that not all functors are valid prediates - the latter must
have no state. Passing remove_if a functor which returns true for,
say, the 3rd item won't work, because it gets copied. See Josuttis
304. remove_copy_if works, but this is not guaranteed.
The following are predefined:
===========================================================================
TECHNICAL REPORT 1
===========================================================================
All TR1 constructs are in the "tr1" namespace.
http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.tr1
unordered_map
unordered_set
Hash-based maps and sets instead of tree-based. Note that
since they require a hash function and not just less, they are
more restrictive in what you can put in - when I tried to put
STL containers in, it didn't work.
===========================================================================
BOOST LIBRARIES
===========================================================================
(as of version 1.33, in Debian Etch)
Any
Safe, generic container for single values of different value types.
Array
STL compliant container wrapper for arrays of constant size.
Assign
Filling containers with constant or generated data has never been easier.
Bind
boost::bind is a generalization of the standard functions std::bind1st and
std::bind2nd. It supports arbitrary function objects, functions, function
pointers, and member function pointers, and is able to bind any argument to
a specific value or route input arguments into arbitrary positions.
CRC
The Boost CRC Library provides two implementations of CRC (cyclic
redundancy code) computation objects and two implementations of CRC
computation functions. The implementations are template-based.
Call Traits
Defines types for passing parameters.
Compatibility
Help for non-conforming standard libraries.
Compressed Pair
Empty member optimization.
Concept Check
Tools for generic programming.
Config
Helps Boost library developers adapt to compiler idiosyncrasies; not
intended for library users.
Conversion
Polymorphic and lexical casts.
Date Time
A set of date-time libraries based on generic programming concepts.
Disjoint Sets
Boost.DisjointSets provides disjoint sets operations with union by rank and
path compression.
Dynamic Bitset
The dynamic_bitset class represents a set of bits. It provides accesses to
the value of individual bits via an operator[] and provides all of the
bitwise operators that one can apply to builtin integers, such as operator&
and operator<<. The number of bits in the set is specified at runtime via a
parameter to the constructor of the dynamic_bitset.
Enable If
Selective inclusion of function template overloads.
Filesystem
The Boost Filesystem Library provides portable facilities to query and
manipulate paths, files, and directories.
Format
The format library provides a class for formatting arguments according to a
format-string, as does printf, but with two major differences: format sends
the arguments to an internal stream, and so is entirely type-safe and
naturally supports all user-defined types; the ellipsis (...) can not be
used correctly in the strongly typed context of format, and thus the
function call with arbitrary arguments is replaced by successive calls to
an argument feeding operator%.
Function
Function object wrappers for deferred calls or callbacks.
Functional
The Boost.Function library contains a family of class templates that are
function object wrappers.
Functional/Hash
A TR1 hash function object that can be extended to hash user defined types.
Graph
The BGL graph interface and graph components are generic, in the same sense
as the the Standard Template Library (STL).
IO State Savers
The I/O sub-library of Boost helps segregate the large number of Boost
headers. This sub-library should contain various items to use with/for the
standard I/O library.
In Place Factory, Typed In Place Factory
Generic in-place construction of contained objects with a variadic
argument-list.
Integer
The organization of boost integer headers and classes is designed to take
advantage of types from the 1999 C standard without resorting to
undefined behavior in terms of the 1998 C++ standard. The header makes the standard integer types safely available in namespace
boost without placing any names in namespace std.
Interval
Extends the usual arithmetic functions to mathematical intervals.
Iostreams
Boost.IOStreams provides a framework for defining streams, stream buffers
and i/o filters.
Iterators
The Boost Iterator Library contains two parts. The first is a system of
concepts which extend the C++ standard iterator requirements. The second is
a framework of components for building iterators based on these extended
concepts and includes several useful iterator adaptors.
Lambda
Define small unnamed function objects at the actual call site, and more.
MPL
The Boost.MPL library is a general-purpose, high-level C++ template
metaprogramming framework of compile-time algorithms, sequences and
metafunctions. It provides a conceptual foundation and an extensive set of
powerful and coherent tools that make doing explict metaprogramming in C++
as easy and enjoyable as possible within the current language.
Math
Boost.Math includes several contributions in the domain of mathematics: The
Greatest Common Divisor and Least Common Multiple library provides run-time
and compile-time evaluation of the greatest common divisor (GCD) or least
common multiple (LCM) of two integers. The Special Functions library
currently provides eight templated special functions, in namespace boost.
The Complex Number Inverse Trigonometric Functions are the inverses of
trigonometric functions currently present in the C++ standard. Quaternions
are a relative of complex numbers often used to parameterise rotations in
three dimentional space. Octonions, like quaternions, are a relative of
complex numbers.
Math Common Factor
Greatest common divisor and least common multiple.
Math Octonion
Octonions.
Math Quaternion
Quaternions.
Member Function
Generalized binders for function/object/pointers and member functions.
Min-Max
Standard library extensions for simultaneous min/max and min/max element
computations.
Multi-Array
Boost.MultiArray provides a generic N-dimensional array concept definition
and common implementations of that interface.
Multi-Index
The Boost Multi-index Containers Library provides a class template named
multi_index_container which enables the construction of containers
maintaining one or more indices with different sorting and access
semantics.
Numeric Conversion
Optimized Policy-based Numeric Conversions.
Operators
Templates ease arithmetic classes and iterators.
Optional
Discriminated-union wrapper for optional values.
Parameter
Boost.Parameter Library - Write functions that accept arguments by name.
Pointer Container
Containers for storing heap-allocated polymorphic objects to ease
OO-programming.
Pool
Memory pool management.
Preprocessor
Preprocessor metaprogramming tools including repetition and recursion.
Program Options
The program_options library allows program developers to obtain program
options, that is (name, value) pairs from the user, via conventional
methods such as command line and config file.
Property Map
Concepts defining interfaces which map key objects to value objects.
Python
The Boost Python Library is a framework for interfacing Python and C++. It
allows you to quickly and seamlessly expose C++ classes functions and
objects to Python, and vice-versa, using no special tools -- just your C++
compiler.
Random
A complete system for random number generation.
Range
A new infrastructure for generic algorithms that builds on top of the new
iterator concepts.
Rational
A rational number class.
Ref
A utility library for passing references to generic functions.
Regex
Regular expression library.
Serialization
Serialization for persistence and marshalling.
Signals
Managed signals & slots callback implementation.
Smart Ptr
* scoped_ptr, scoped_array
Noncopyable ownership
* shared_ptr, shared_array
Implemented by reference counting. Has implicit conversions from
shared_ptr to shared_ptr__ when there's a conversion from T* to U*
* weak_ptr
Non-owning observers of shared_ptr
* intrusive_ptr
For objects with embedded reference count. Calls non-member
intrusive_ptr_add_ref and intrusive_ptr_release with pointer
as argument.
Spirit
LL parser framework represents parsers directly as EBNF grammars in inlined
C++.
Static Assert
Static assertions (compile time assertions).
String Algo
String algorithms library.
Test
Support for simple program testing, full unit testing, and for program
execution monitoring.
Thread
Portable C++ multi-threading.
Timer
Event timer, progress timer, and progress display classes.
Tokenizer
Break of a string or other character sequence into a series of tokens.
Tribool
3-state boolean type library.
Tuple
Ease definition of functions returning multiple values, and more.
Type Traits
Templates for fundamental properties of types.
Utility
Class noncopyable plus checked_delete(), checked_array_delete(), next(),
prior() function templates, plus base-from-member idiom.
Value Initialized
Wrapper for uniform-syntax value initialization, based on the original idea
of David Abrahams.
Variant
Safe, generic, stack-based discriminated union container.
Wave
The Boost.Wave library is a Standards conformant, and highly configurable
implementation of the mandated C99/C++ preprocessor functionality packed
behind an easy to use iterator interface.
uBLAS
uBLAS provides matrix and vector classes as well as basic linear algebra
routines. Several dense, packed and sparse storage schemes are supported.
vi: set tw=75 ai:
__