Go to the source code of this file.
Classes | |
class | TfGet< N > |
Function object for retrieving the N'th element of a std::pair or std::tuple. More... | |
Functions | |
template<class Container , class Key , class Result > | |
bool | TfMapLookup (Container const &map, Key const &key, Result *valuePtr) |
Checks if an item exists in a map or a TfHashMap . More... | |
template<class Container , class Key , class Result > | |
const Result | TfMapLookupByValue (Container const &map, Key const &key, const Result &defaultValue) |
Checks if an item exists in a map or a TfHashMap . More... | |
template<class Container , class Key > | |
Container::mapped_type * | TfMapLookupPtr (Container &map, Key const &key) |
Checks if an item exists in a map or TfHashMap , without copying it. More... | |
template<class Container , class Key > | |
Container::mapped_type const * | TfMapLookupPtr (Container const &map, Key const &key) |
template<typename T > | |
std::pair< T, T > | TfOrderedPair (T a, T b) |
Return an std::pair in sorted order. More... | |
template<class T > | |
void | TfReset (T &obj) |
Reset obj to be an empty, space-optimized object. More... | |
template<class Key , class Value , class Hash , class Equal , class Alloc > | |
void | TfReset (TfHashMap< Key, Value, Hash, Equal, Alloc > &hash) |
Specialize for TfHashMap to make minimally sized hashes. More... | |
template<class Value , class Hash , class Equal , class Alloc > | |
void | TfReset (TfHashSet< Value, Hash, Equal, Alloc > &hash) |
Specialize for TfHashSet to make minimally sized hashes. More... | |
template<class T > | |
boost::call_traits< T >::param_type | TfIdentity (typename boost::call_traits< T >::param_type arg) |
An unary function that represents the identity function; it takes a single argument arg, and returns arg. More... | |
template<class InputIterator1 , class InputIterator2 , class OutputIterator > | |
void | TfOrderedSetDifference (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result) |
Produce a sequence consisting of the set difference of [first1, last1) and [first2, last2), while maintaining the relative order of the first sequence. More... | |
template<class BackInsertionSequence , class InputIterator1 , class InputIterator2 > | |
BackInsertionSequence | TfOrderedSetDifferenceToContainer (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2) |
Produce a sequence consisting of the set difference of [first1, last1) and [first2, last2), while maintaining the relative order of the first sequence. More... | |
template<class InputIterator1 , class InputIterator2 , class OutputIterator > | |
void | TfOrderedUniquingSetDifference (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result) |
Produce a sequence consisting of the set difference of the unique elements in [first1, last1) and [first2, last2), while maintaining the relative order of the first sequence. More... | |
template<class BackInsertionSequence , class InputIterator1 , class InputIterator2 > | |
BackInsertionSequence | TfOrderedUniquingSetDifferenceToContainer (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2) |
Produce a sequence consisting of the set difference of the unique elements in [first1, last1) and [first2, last2), while maintaining the relative order of the first sequence. More... | |
|
inline |
void TfOrderedSetDifference | ( | InputIterator1 | first1, |
InputIterator1 | last1, | ||
InputIterator2 | first2, | ||
InputIterator2 | last2, | ||
OutputIterator | result | ||
) |
Produce a sequence consisting of the set difference of [first1, last1) and [first2, last2), while maintaining the relative order of the first sequence.
No particular order is required for either range, but elements must have a strict weak order provided by operator<.
If an element appears multiple times in either the first or second sequence, the number of occurrences in the output is the difference between the first sequence and the second (or zero if there are more occurrences in the second sequence). For example, if the first sequence is (1, 3, 3, 1) and the second sequence is (2, 3, 2), the result will be (1, 3, 1).
BackInsertionSequence TfOrderedSetDifferenceToContainer | ( | InputIterator1 | first1, |
InputIterator1 | last1, | ||
InputIterator2 | first2, | ||
InputIterator2 | last2 | ||
) |
Produce a sequence consisting of the set difference of [first1, last1) and [first2, last2), while maintaining the relative order of the first sequence.
No particular order is required for either range, but elements must have a strict weak order provided by operator<.
If an element appears multiple times in either the first or second sequence, the number of occurrences in the output is the difference between the first sequence and the second (or zero if there are more occurrences in the second sequence). For example, if the first sequence is (1, 3, 3, 1) and the second sequence is (2, 3, 2), the result will be (1, 3, 1).
void TfOrderedUniquingSetDifference | ( | InputIterator1 | first1, |
InputIterator1 | last1, | ||
InputIterator2 | first2, | ||
InputIterator2 | last2, | ||
OutputIterator | result | ||
) |
Produce a sequence consisting of the set difference of the unique elements in [first1, last1) and [first2, last2), while maintaining the relative order of the first sequence.
No particular order is required for either range, but elements must have a strict weak order provided by operator<.
If an element appears multiple times in the first sequence, it appears either zero or one times in the output. It appears zero times if it appears in the second sequence, and one time if it does not. For example, if the first sequence is (1, 3, 3, 1) and the second sequence is (2, 3, 2), the result will be (1).
BackInsertionSequence TfOrderedUniquingSetDifferenceToContainer | ( | InputIterator1 | first1, |
InputIterator1 | last1, | ||
InputIterator2 | first2, | ||
InputIterator2 | last2 | ||
) |
Produce a sequence consisting of the set difference of the unique elements in [first1, last1) and [first2, last2), while maintaining the relative order of the first sequence.
No particular order is required for either range, but elements must have a strict weak order provided by operator<.
If an element appears multiple times in the first sequence, it appears either zero or one times in the output. It appears zero times if it appears in the second sequence, and one time if it does not. For example, if the first sequence is (1, 3, 3, 1) and the second sequence is (2, 3, 2), the result will be (1).
|
inline |
Reset obj to be an empty, space-optimized object.
This can be used to clear c++ containers and reclaim their memory. For instance, std::vector::clear() will not reclaim any memory, even if the vector previously had a large number of elements. Often, this is what you want because the vector is later filled again. But sometimes you want to reclaim the memory, and this function will do that.
As another example, gcc's hash_map and hash_set do not clear their bucket lists when they themselves are cleared. This can lead to poor performance due to ever-growing bucket lists for hashes that are repeatedly filled, cleared, and filled again. TfReset will avoid this by effectively clearing the bucket list.
This function requires that the expression T().swap(obj) where obj is of type T& be valid. This is true for many classes, including the standard containers.
|
inline |