QuickCheck++  0.0.3
Automated testing library
ostream.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 Cyril Soldani
3  *
4  * This file is part of QuickCheck++.
5  *
6  * QuickCheck++ is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation, either version 3 of the License, or (at your option)
9  * any later version.
10  *
11  * QuickCheck++ is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * QuickCheck++. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
32 #ifndef QUICKCHECK_OSTREAM_H
33 #define QUICKCHECK_OSTREAM_H
34 
35 #include <iostream>
36 #include <vector>
37 
38 namespace quickcheck {
39 
48 template<class A>
49 std::ostream& operator<<(std::ostream& out, const std::vector<A>& xs)
50 {
51  out << "[";
52  for (size_t i = 0; i < xs.size(); ++i)
53  if (i == xs.size() - 1)
54  out << xs[i];
55  else
56  out << xs[i] << ", ";
57  return out << "]";
58 }
59 
60 }
61 
62 #endif // !QUICKCHECK_OSTREAM_H