From 7b6b7125654bb7b9836b793c58ecf0622a8d9bb8 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Mon, 10 Sep 2018 15:17:32 +0100 Subject: [PATCH] function to convert std::vector to string --- Grid/serialisation/VectorUtils.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Grid/serialisation/VectorUtils.h b/Grid/serialisation/VectorUtils.h index 880744ec..b6b95c10 100644 --- a/Grid/serialisation/VectorUtils.h +++ b/Grid/serialisation/VectorUtils.h @@ -423,4 +423,17 @@ namespace Grid { } } +// helper function to read space-separated values +template +std::string vecToStr(const std::vector &v) +{ + using Grid::operator<<; + + std::ostringstream sstr; + + sstr << v; + + return sstr.str(); +} + #endif \ No newline at end of file