diff --git a/extras/Hadrons/Global.hpp b/extras/Hadrons/Global.hpp index ed8f4f32..e9f5933b 100644 --- a/extras/Hadrons/Global.hpp +++ b/extras/Hadrons/Global.hpp @@ -43,12 +43,15 @@ See the full license in the file "LICENSE" in the top level distribution directo namespace Grid {\ using namespace QCD;\ namespace Hadrons {\ -using Grid::operator<<; +using Grid::operator<<;\ +using Grid::operator>>; #define END_HADRONS_NAMESPACE }} #define BEGIN_MODULE_NAMESPACE(name)\ namespace name {\ -using Grid::operator<<; +using Grid::operator<<;\ +using Grid::operator>>; + #define END_MODULE_NAMESPACE } /* the 'using Grid::operator<<;' statement prevents a very nasty compilation diff --git a/lib/serialisation/BaseIO.h b/lib/serialisation/BaseIO.h index 24e1cec7..d2db8bfc 100644 --- a/lib/serialisation/BaseIO.h +++ b/lib/serialisation/BaseIO.h @@ -33,42 +33,6 @@ Author: Guido Cossu #include namespace Grid { - // Vector IO utilities /////////////////////////////////////////////////////// - // helper function to read space-separated values - template - std::vector strToVec(const std::string s) - { - std::istringstream sstr(s); - T buf; - std::vector v; - - while(!sstr.eof()) - { - sstr >> buf; - v.push_back(buf); - } - - return v; - } - - // output to streams for vectors - template < class T > - inline std::ostream & operator<<(std::ostream &os, const std::vector &v) - { - os << "["; - for (auto &x: v) - { - os << x << " "; - } - if (v.size() > 0) - { - os << "\b"; - } - os << "]"; - - return os; - } - // Vector element trait ////////////////////////////////////////////////////// template struct element @@ -151,15 +115,15 @@ namespace Grid { do { is.get(c); - } while (c != '<' && !is.eof()); - if (c == '<') + } while (c != '{' && !is.eof()); + if (c == '{') { int start = is.tellg(); do { is.get(c); - } while (c != '>' && !is.eof()); - if (c == '>') + } while (c != '}' && !is.eof()); + if (c == '}') { int end = is.tellg(); int psize = end - start - 1; @@ -182,7 +146,43 @@ namespace Grid { template inline std::ostream & operator<<(std::ostream &os, const std::pair &p) { - os << "<" << p.first << " " << p.second << ">"; + os << "{" << p.first << " " << p.second << "}"; + return os; + } + + // Vector IO utilities /////////////////////////////////////////////////////// + // helper function to read space-separated values + template + std::vector strToVec(const std::string s) + { + std::istringstream sstr(s); + T buf; + std::vector v; + + while(!sstr.eof()) + { + sstr >> buf; + v.push_back(buf); + } + + return v; + } + + // output to streams for vectors + template < class T > + inline std::ostream & operator<<(std::ostream &os, const std::vector &v) + { + os << "["; + for (auto &x: v) + { + os << x << " "; + } + if (v.size() > 0) + { + os << "\b"; + } + os << "]"; + return os; }