From f417974f5bd330f981ef9c848574237c4dd45e45 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 7 Apr 2005 21:28:57 +0000 Subject: [PATCH] Added iostream operators --- include/osg/Vec4d | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/include/osg/Vec4d b/include/osg/Vec4d index 0c4cb9596..12f8011a4 100644 --- a/include/osg/Vec4d +++ b/include/osg/Vec4d @@ -236,18 +236,27 @@ class Vec4d return( norm ); } - friend inline std::ostream& operator << (std::ostream& output, const Vec4d& vec) - { - output << vec._v[0] << " " - << vec._v[1] << " " - << vec._v[2] << " " - << vec._v[3]; - return output; // to enable cascading - } - }; // end of class Vec4d +// streaming operators + +inline std::ostream& operator << (std::ostream& output, const Vec4d& vec) +{ + output << vec._v[0] << " " + << vec._v[1] << " " + << vec._v[2] << " " + << vec._v[3]; + return output; // to enable cascading +} + +inline std::istream& operator >> (std::istream& input, Vec4d& vec) +{ + input >> vec._v[0] >> vec._v[1] >> vec._v[2] >> vec._v[3]; + return input; +} + + /** Compute the dot product of a (Vec3,1.0) and a Vec4d. */ inline Vec4d::value_type operator * (const Vec3d& lhs,const Vec4d& rhs) {