From 236fbf4dda20d63c2723fff1024126c95f5358da Mon Sep 17 00:00:00 2001 From: Yichao Yu <yyc1992@gmail.com> Date: Thu, 19 Jun 2014 01:34:27 +0800 Subject: [PATCH] better printing format --- src/c_wrapper/error.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/c_wrapper/error.h b/src/c_wrapper/error.h index aadc02a5..f7dc72b2 100644 --- a/src/c_wrapper/error.h +++ b/src/c_wrapper/error.h @@ -111,18 +111,22 @@ struct __CLPrintOut<T, typename std::enable_if< static inline void call(T v, std::ostream &stm) { - v.print(stm, true); stm << ", "; + v.print(stm, true); } }; template<typename T, class = void> struct __CLPrint { static inline void - call(T v, std::ostream &stm) + call(T v, std::ostream &stm, bool &&first) { + if (!first) { + stm << ", "; + } else { + first = false; + } v.print(stm); - stm << ", "; } }; @@ -158,8 +162,8 @@ class CLArgPack : public ArgPack<CLArg, Types...> { typename CLArgPack::tuple_base *that = this; std::cerr << name << "("; __CLCall<__CLPrint, sizeof...(Types) - 1, - decltype(*that)>::call(*that, std::cerr); - std::cerr << ") = (" << res << ", "; + decltype(*that)>::call(*that, std::cerr, true); + std::cerr << ") = (" << res; __CLCall<__CLPrintOut, sizeof...(Types) - 1, decltype(*that)>::call(*that, std::cerr); std::cerr << ")" << std::endl; -- GitLab