1 // Copyright (c) 2013 Erik Schnetter
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #ifndef DEFS_HH
7 #define DEFS_HH
8 
9 #include <cstddef>
10 #include <cstdlib>
11 #include <iostream>
12 #include <sstream>
13 #include <vector>
14 
15 
16 template<typename T>
operator <<(std::ostream & os,const std::vector<T> v)17 std::ostream& operator<<(std::ostream& os, const std::vector<T> v)
18 {
19   os << "[";
20   for (std::size_t i=0; i<v.size(); ++i) {
21     if (i != 0) os << ",";
22     os << v[i];
23   }
24   os << "]";
25   return os;
26 }
27 
28 template<typename T>
mkstr(const T & x)29 std::string mkstr(const T& x)
30 {
31   std::ostringstream os;
32   os << x;
33   return os.str();
34 }
35 
36 #endif  // #ifndef DEFS_HH
37