STLUtils.h File Reference

This file contains several utility functions for dealing with STL containers. More...

#include <algorithm>
#include <list>
#include <map>
#include <set>
#include <vector>

Go to the source code of this file.

Namespaces

 te
 URI C++ Library.
 
 te::common
 Namespace for the Common module of TerraLib.
 

Functions

template<class T >
void te::common::Clone (const std::vector< T * > &src, std::vector< T * > &dst)
 This function can be applied to a vector of pointers. More...
 
template<class T >
bool te::common::Contains (const std::vector< T > &src, const T &value)
 
template<class T >
void te::common::Copy (const std::vector< T * > &src, std::vector< T * > &dst)
 This function can be applied to a vector of pointers. It will copy element by element through its copy constructor supposing a vector of pointers. More...
 
template<class T >
void te::common::Free (std::vector< T * > *v)
 This function can be applied to a pointer to a vector of pointers. More...
 
void te::common::Free (char **carray)
 It releases the char array. More...
 
template<class T >
void te::common::Free (T **a, std::size_t s)
 It releases the given array. More...
 
template<class T >
void te::common::FreeContents (const std::vector< T * > &v)
 This function can be applied to a vector of pointers. It will delete each pointer in the vector. More...
 
template<class T >
void te::common::FreeContents (std::list< T * > &l)
 This function can be applied to a list of pointers. It will delete each pointer in the vector. More...
 
template<class K , class V >
void te::common::FreeContents (std::map< K, V * > &m)
 This function can be applied to a map of pointers. It will delete each pointer in the map. More...
 
template<class V , class C >
void te::common::FreeContents (std::set< V *, C > &m)
 This function can be applied to a map of pointers. It will delete each pointer in the map. More...
 
template<class IT >
void te::common::FreeContents (IT it, IT itend)
 This function can be applied to a vector of pointers. It will delete each pointer in the vector. More...
 
template<class K , class V >
V ** te::common::GetPPValue (std::map< K, V * > &m, const K &k)
 It finds for a given key in the map and returns a pointer if something is found or NULL otherwise. More...
 
template<class K , class V >
V * te::common::GetPValue (const std::map< K, V * > &m, const K &k)
 It finds for a given key in the map and returns a pointer if something is found or NULL otherwise. More...
 
template<class K , class C >
K * te::common::GetPValue (const std::set< K *, C > &m, K *k)
 It finds for a given key in the map and returns a pointer if something is found or NULL otherwise. More...
 

Detailed Description

This file contains several utility functions for dealing with STL containers.

Definition in file STLUtils.h.