From 9e973c7245f28bae3a90a4ef50f74ef26da216db Mon Sep 17 00:00:00 2001 From: Yichao Yu Date: Thu, 19 Jun 2014 01:29:40 +0800 Subject: [PATCH] minor tweaks --- src/c_wrapper/error.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/c_wrapper/error.h b/src/c_wrapper/error.h index e847a1a0..aadc02a5 100644 --- a/src/c_wrapper/error.h +++ b/src/c_wrapper/error.h @@ -152,6 +152,18 @@ struct __CLCall { template class CLArgPack : public ArgPack { + template void + _print_trace(T &res, const char *name) + { + typename CLArgPack::tuple_base *that = this; + std::cerr << name << "("; + __CLCall<__CLPrint, sizeof...(Types) - 1, + decltype(*that)>::call(*that, std::cerr); + std::cerr << ") = (" << res << ", "; + __CLCall<__CLPrintOut, sizeof...(Types) - 1, + decltype(*that)>::call(*that, std::cerr); + std::cerr << ")" << std::endl; + } public: using ArgPack::ArgPack; template @@ -161,14 +173,7 @@ public: { auto res = this->template call<__CLArgGetter>(func); if (DEBUG_ON) { - typename CLArgPack::tuple_base *that = this; - std::cerr << name << "("; - __CLCall<__CLPrint, sizeof...(Types) - 1, - decltype(*that)>::call(*that, std::cerr); - std::cerr << ") = (" << res << ", "; - __CLCall<__CLPrintOut, sizeof...(Types) - 1, - decltype(*that)>::call(*that, std::cerr); - std::cerr << ")" << std::endl; + _print_trace(res, name); } return res; } -- GitLab