From d30aba45e0cc591d95340f23c2ad939cbbd321e2 Mon Sep 17 00:00:00 2001 From: jan p springer Date: Wed, 14 Jan 2015 22:10:55 +0000 Subject: [PATCH] added: operator<< for tvec1<> --- glm/gtx/io.hpp | 2 ++ glm/gtx/io.inl | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/glm/gtx/io.hpp b/glm/gtx/io.hpp index 5630d92b..b3842bbd 100644 --- a/glm/gtx/io.hpp +++ b/glm/gtx/io.hpp @@ -188,6 +188,8 @@ namespace glm template GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tquat const&); template + GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tvec1 const&); + template GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tvec2 const&); template GLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, tvec3 const&); diff --git a/glm/gtx/io.inl b/glm/gtx/io.inl index fe5f1949..5af266dd 100644 --- a/glm/gtx/io.inl +++ b/glm/gtx/io.inl @@ -218,6 +218,36 @@ namespace io return os; } + template + GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tvec1 const& a) + { + typename std::basic_ostream::sentry const cerberus(os); + + if(cerberus) + { + io::format_punct const & fmt(io::get_facet >(os)); + + if(fmt.formatted) + { + io::basic_state_saver const bss(os); + + os << std::fixed + << std::right + << std::setprecision(fmt.precision) + << std::setfill(fmt.space) + << fmt.delim_left + << std::setw(fmt.width) << a.x + << fmt.delim_right; + } + else + { + os << a.x; + } + } + + return os; + } + template GLM_FUNC_QUALIFIER std::basic_ostream& operator<<(std::basic_ostream& os, tvec2 const& a) {