From ee14800927afed0054463a650d3ac56847239b12 Mon Sep 17 00:00:00 2001 From: jcasals <jcasals@iri.upc.edu> Date: Mon, 15 Jun 2020 16:58:16 +0200 Subject: [PATCH] Add char type to converter.h --- include/core/utils/converter.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/core/utils/converter.h b/include/core/utils/converter.h index c97dd0ace..8388f2993 100644 --- a/include/core/utils/converter.h +++ b/include/core/utils/converter.h @@ -94,6 +94,14 @@ struct converter<bool>{ } }; template<> +struct converter<char>{ + static char convert(std::string val){ + //Here we should check that val.length() == 1 and get val[0] into a char variable + throw std::runtime_error("Invalid char conversion. String provided: " + val); + } +}; + //// TYPES ----> ToSTRING +template<> struct converter<std::string>{ static std::string convert(std::string val){ return val; @@ -109,6 +117,9 @@ struct converter<std::string>{ static std::string convert(double val){ return std::to_string(val); } + static std::string convert(char val){ + return std::to_string(val); + } template<typename A> static std::string convert(utils::list<A> val){ std::string result = ""; -- GitLab