Compounds | |
class | index_iterator |
Simple iterator adapter class providing element indexes instead of elements. More... | |
struct | max_fnobj |
Function object returning the maximum of the two given objects of identical type. More... | |
struct | name_match |
Predicate object applicable to any container of pointers to objects which have a name() member function. More... | |
struct | Polar |
Function object for constructing a complex number from a (rho,theta) pair. More... | |
struct | unary_virtual_function |
Version of unary_function suitable for non-templated functions which must take a specific type of argument. More... | |
Functions | |
template<class key_type, class data_type> void | delete_contents (std::map< key_type, data_type * > &m) |
Specialization of general delete_contents algorithm for a map of pointers. | |
template<class T1, class T2> std::pair< const T1, T2 > | make_pair_leftconst (const T1 &x, const T2 &y) |
Variant of make_pair which keeps the left item const; useful for maps. | |
template<class T, class C, class N> void | insert_named (C &container, const N &name, T *objptr) |
Insert a named object into any pointer container supporting push_back, overwriting and deleting any existing object with that name (using the objects name() function). | |
template<class T, class C, class N> T * | find_named (C &container, const N &name) |
Returns a pointer to the first object found with the given name() in the given container. | |
template<class T, class C, class N> const T * | find_named_const (const C &container, const N &name) |
Returns a pointer to the first object found with the given name() in the given container. | |
template<class T> T | sum (const std::vector< T > &A) |
Sum of the elements of a vector. | |
template<class T> const T | crop (const T lower, const T upper, const T x) |
Crops to the given (inclusive) range, truncating at each end of the range. | |
template<class T> const T | wrap (const T lower, const T upper, const T x) |
Circularly aliases (wraps) to the given (inclusive) range, as angles do. | |
template<class T> int | round (const T x) |
Round the given floating-point value to the nearest integer. | |
template<class Container> void | delete_contents (Container &c) |
Deletes all pointed-to items and removes them from the given container; any standard container of pointers should work. | |
template<class Container> void | nested_delete_contents (Container &c) |
Version of delete_contents for containers of pointers to containers; deletes all pointed-to items in the subcontainers, then deletes the subcontainers themselves. | |
template<class ForwardIterator, class T> void | lower_threshold (ForwardIterator first, ForwardIterator last, const T &threshold, const T &new_value) |
Apply a lower threshold to any container, with a cropping value that can be different from the threshold. | |
template<class InputIterator, class ForwardIterator, class T> void | lower_threshold (InputIterator ifirst, InputIterator ilast, ForwardIterator ofirst, const T &threshold, const T &new_value) |
Copy a container into a new one, for each element applying a lower threshold. | |
template<class ForwardIterator, class T> void | upper_threshold (ForwardIterator first, ForwardIterator last, const T &threshold, const T &new_value) |
Apply an upper threshold to any container, with a cropping value that can be different from the threshold. | |
template<class InputIterator, class ForwardIterator, class T> void | upper_threshold (InputIterator ifirst, InputIterator ilast, ForwardIterator ofirst, const T &threshold, const T &new_value) |
Copy a container into a new one, for each element applying an upper threshold. | |
template<class InputIterator, class T, class Operation> T | accumulate (InputIterator beg, InputIterator end, T init, Operation op) |
Same as std::accumulate but accepts an object to compute the value instead of one to compute and do the summation both; often the former is already available but a special function would have to be written to get the latter. | |
template<class InputIterator, class T, class Operation, class BinaryOperation> T | accumulate (InputIterator beg, InputIterator end, T init, Operation op, BinaryOperation binop) |
Same as std::accumulate called with a binary operator, but splits the operation into two operations, one called first on the value and the other called to combine the two. | |
template<class T> T | hypot (T x, T y) |
Substitutes for system function not always available. |
|
Same as std::accumulate called with a binary operator, but splits the operation into two operations, one called first on the value and the other called to combine the two. The standard version requires that the same function do both; such functions are rarely already available. Definition at line 158 of file genericalgs.h. |
|
Returns a pointer to the first object found with the given name() in the given container. The type T is the underlying type (not the pointer type) of the objects pointed to by each element of the container; there doesn't appear to be any way to deduce it from C::value_type (which should be T*). Definition at line 109 of file generic_stdlib.h. |
|
Returns a pointer to the first object found with the given name() in the given container. (const version of find_named.) Definition at line 123 of file generic_stdlib.h. |
|
Insert a named object into any pointer container supporting push_back, overwriting and deleting any existing object with that name (using the objects name() function). Since the existing object may be deleted, the container must own the objects to which it points. Definition at line 88 of file generic_stdlib.h. Referenced by LissomMap::add_input(), FixedWtRegion::add_input(), and WorldViews::define(). |
|
Circularly aliases (wraps) to the given (inclusive) range, as angles do. I have no idea how I came up with this algorithm; it can probably be simplified. Files using this routine will need to add: #include <cmath> Definition at line 54 of file genericalgs.h. Referenced by Histo::OneDBinList< Count, Value >::vector_direction(). |