25 template <
class T,
class CONTAINER>
28 auto last = vect.end();
29 for (
auto i = vect.begin(); i != last; ++i)
31 return std::string::npos;
38 std::list<T>& cont,
typename std::list<T>::iterator& it)
40 return cont.erase(it);
43 template <
class K,
class V>
45 std::map<K, V>& cont,
typename std::map<K, V>::iterator& it)
47 typename std::map<K, V>::iterator itRet = it;
53 template <
class K,
class V>
55 std::multimap<K, V>& cont,
typename std::multimap<K, V>::iterator& it)
57 typename std::multimap<K, V>::iterator itRet = it;
65 std::set<T>& cont,
typename std::set<T>::iterator& it)
82 for (
auto& e :
t) ss << e <<
", ";
104 for (
typename T::const_iterator it =
t.begin(); it !=
t.end(); ++i, ++it)
106 cout <<
"List " << i + 1 <<
"/" <<
t.size() << endl <<
"\t";
117 template <
class T1,
class T2>
119 const std::map<T1, T2>& m,
const std::string& sep =
" => ")
121 std::stringstream ss;
122 for (
auto& key_val : m)
123 ss << key_val.first <<
" => " << key_val.second <<
"\n";
130 template <
class T1,
class T2>
138 template <
class CONTAINER>
std::string getMapAsString(const std::map< T1, T2 > &m, const std::string &sep=" => ")
Return contents of map in a string representation.
void printSTLContainer(const T &t)
Print the given vector t.
size_t find_in_vector(const T &value, const CONTAINER &vect)
Returns the index of the value "T" in the container "vect" (std::vector,std::deque,etc), or string::npos if not found.
std::list< T >::iterator erase_return_next(std::list< T > &cont, typename std::list< T >::iterator &it)
Calls the standard "erase" method of a STL container, but also returns an iterator to the next elemen...
GLsizei const GLchar ** string
void printMap(const std::map< T1, T2 > &m)
Print the given map m.
void deep_clear(CONTAINER &c)
Deep clear for a std vector container.
void printSTLContainerOfContainers(const T &t)
Print the given STL container of containers t.
GLsizei const GLfloat * value
std::string getSTLContainerAsString(const T &t)
Return a STL container in std::string form.
double distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.