Rivet is hosted by Hepforge, IPPP Durham
RivetSTL.hh File Reference
#include <string>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <utility>
#include <algorithm>
#include <type_traits>
#include <stdexcept>
#include <cassert>
#include <memory>
#include <typeinfo>
#include <sstream>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <limits>
Include dependency graph for RivetSTL.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Rivet

Defines

#define foreach(value, container)   for (value : container)
 A foreach macro for backward compatibility with BOOST_FOREACH

Functions

Streaming containers as string reps
Todo:

Make these named toStr rather than operator<<

Make these generic to any iterable

template<typename T >
std::ostream & operator<< (std::ostream &os, const std::vector< T > &vec)
 Convenient function for streaming out vectors of any streamable object.
template<typename T >
std::ostream & operator<< (std::ostream &os, const std::list< T > &vec)
 Convenient function for streaming out lists of any streamable object.
Boolean-return container searching
bool contains (const std::string &s, const std::string &sub)
 Does s contain sub as a substring?
template<typename T >
bool contains (const std::vector< T > &v, const T &x)
 Does the vector v contain x?
template<typename T >
bool contains (const std::list< T > &l, const T &x)
 Does the list l contain x?
template<typename T >
bool contains (const std::set< T > &s, const T &x)
 Does the set s contain x?
template<typename K , typename T >
bool has_key (const std::map< K, T > &m, const K &key)
 Does the map m contain the key key?
template<typename K , typename T >
bool has_value (const std::map< K, T > &m, const T &val)
 Does the map m contain the value val?
Container filling and merging
template<typename T >
void operator+= (std::vector< T > &v, const T &x)
 Append a single item to vector v.
template<typename T >
void operator+= (std::vector< T > &v1, const std::vector< T > &v2)
 Append all the items from vector v2 to vector v1.
template<typename T >
std::vector< T > operator+ (const std::vector< T > &v1, const std::vector< T > &v2)
 Create a new vector from the concatenated items in vectors v1 and v2.
template<typename T >
void operator+= (std::set< T > &s1, const std::set< T > &s2)
 Merge the contents of set s2 into s1.
template<typename T >
std::set< T > operator+ (const std::set< T > &s1, const std::set< T > &s2)
 Merge the contents of sets s1 and s2.
Function helpers
template<typename T , typename... U>
size_t get_address (std::function< T(U...)> f)
 Get a function pointer / hash integer from an std::function.

Define Documentation

#define foreach (   value,
  container 
)    for (value : container)

A foreach macro for backward compatibility with BOOST_FOREACH

Definition at line 26 of file RivetSTL.hh.