diff --git a/include/cantera/base/vec_functions.h b/include/cantera/base/vec_functions.h index f9171e6dd..061256b6a 100644 --- a/include/cantera/base/vec_functions.h +++ b/include/cantera/base/vec_functions.h @@ -14,7 +14,7 @@ #include #include #include - +#include #include namespace Cantera @@ -181,6 +181,20 @@ inline T absmax(const std::vector& v) return maxval; } +//! Write a vector to a stream +template +inline std::ostream& operator<<(std::ostream& os, const std::vector& v) +{ + size_t n = v.size(); + for (size_t i = 0; i < n; i++) { + os << v[i]; + if (i != n-1) { + os << ", "; + } + } + return os; +} + } #endif