aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Requirements/src/util.hh
blob: 73b5faa1e8faac2ae20e64f37010b69193f6aac3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef UTIL_HH
#define UTIL_HH

#include <iostream>
#include <vector>

namespace Requirements {

using namespace std;

  // taken from defs.cc and defs.hh
  // Vector output
  template<class T>
  inline ostream& output (ostream& os, const vector<T>& v) {
    os << "[";
    // Do not number the elements, as this would lead to a format that
    // cannot be read back in.
  //   int cnt=0;
    for (typename vector<T>::const_iterator ti=v.begin(); ti!=v.end(); ++ti) {
      if (ti!=v.begin()) os << ",";
  //     os << cnt++ << ":";
      os << *ti;
    }
    os << "]";
    return os;
  }

  template<class T>
  inline ostream& operator<< (ostream& os, const vector<T>& v) {
    return Requirements::output(os,v);
  }

};

#endif