From bb7717ca7afe109d5a0b9a6bfb2d638f35255278 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Sat, 16 May 2015 22:22:21 +0200 Subject: [PATCH] add printing capability to ptr_vector --- alib2std/src/extensions/vector.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/alib2std/src/extensions/vector.hpp b/alib2std/src/extensions/vector.hpp index 7b23d98f75..28397c3caa 100644 --- a/alib2std/src/extensions/vector.hpp +++ b/alib2std/src/extensions/vector.hpp @@ -177,6 +177,21 @@ std::ostream& operator<<(std::ostream& out, const std::vector<T>& vector) { return out; } +template< class T > +std::ostream& operator<<(std::ostream& out, const std::ptr_vector<T>& vector) { + out << "["; + + bool first = true; + for(const T& item : vector) { + if(!first) out << ", "; + first = false; + out << item; + } + + out << "]"; + return out; +} + template<class T> struct compare<vector<T>> { int operator()(const vector<T>& first, const vector<T>& second) const { -- GitLab