diff options
-rw-r--r-- | gentoobrowse-api/domain/converters.impl.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/gentoobrowse-api/domain/converters.impl.h b/gentoobrowse-api/domain/converters.impl.h index 25f9266..894d0de 100644 --- a/gentoobrowse-api/domain/converters.impl.h +++ b/gentoobrowse-api/domain/converters.impl.h @@ -22,13 +22,6 @@ namespace Slicer { std::vector<T> & list; }; - template<typename T> - typename std::enable_if<std::is_arithmetic<T>::value>::type - packPqVar(std::ostream & s, const T & l) - { - s << l; - } - std::string escapePqChar(char c) { @@ -38,12 +31,18 @@ namespace Slicer { return std::string(1, c); } + template<typename T> void - packPqVar(std::ostream & s, const std::string & l) + packPqVar(std::ostream & s, const T & l) { - s << "\""; - std::transform(l.begin(), l.end(), std::ostream_iterator<std::string>(s), escapePqChar); - s << "\""; + if constexpr (std::is_arithmetic<T>::value) { + s << l; + } + else { + s << "\""; + std::transform(l.begin(), l.end(), std::ostream_iterator<std::string>(s), escapePqChar); + s << "\""; + } } template <typename T> |