@@ -52,35 +52,43 @@ struct ConvertionAllowed<bool> : std::true_type
5252{
5353};
5454template <>
55- struct ConvertionAllowed <uint64_t > : std::true_type
55+ struct ConvertionAllowed <long long > : std::true_type
5656{
5757};
5858template <>
59- struct ConvertionAllowed <int64_t > : std::true_type
59+ struct ConvertionAllowed <unsigned long long > : std::true_type
6060{
6161};
6262template <>
63- struct ConvertionAllowed <uint32_t > : std::true_type
63+ struct ConvertionAllowed <long > : std::true_type
6464{
6565};
6666template <>
67- struct ConvertionAllowed <int32_t > : std::true_type
67+ struct ConvertionAllowed <unsigned long > : std::true_type
6868{
6969};
7070template <>
71- struct ConvertionAllowed <uint16_t > : std::true_type
71+ struct ConvertionAllowed <int > : std::true_type
7272{
7373};
7474template <>
75- struct ConvertionAllowed <int16_t > : std::true_type
75+ struct ConvertionAllowed <unsigned int > : std::true_type
7676{
7777};
7878template <>
79- struct ConvertionAllowed <int8_t > : std::true_type
79+ struct ConvertionAllowed <short > : std::true_type
8080{
8181};
8282template <>
83- struct ConvertionAllowed <uint8_t > : std::true_type
83+ struct ConvertionAllowed <unsigned short > : std::true_type
84+ {
85+ };
86+ template <>
87+ struct ConvertionAllowed <unsigned char > : std::true_type
88+ {
89+ };
90+ template <>
91+ struct ConvertionAllowed <signed char > : std::true_type
8492{
8593};
8694template <>
@@ -98,11 +106,11 @@ struct ConvertionAllowedVia : std::false_type
98106{
99107};
100108template <>
101- struct ConvertionAllowedVia <uint8_t , uint32_t > : std::true_type
109+ struct ConvertionAllowedVia <unsigned char , unsigned int > : std::true_type
102110{
103111};
104112template <>
105- struct ConvertionAllowedVia <int8_t , int32_t > : std::true_type
113+ struct ConvertionAllowedVia <signed char , int > : std::true_type
106114{
107115};
108116
@@ -191,16 +199,16 @@ static inline bool convertTo(const std::string &str, T &result)
191199 return details::convertTo<T>(str, result);
192200}
193201
194- /* * Specialization for uint8_t of convertTo template function.
202+ /* * Specialization for unsigned char of convertTo template function.
195203 *
196204 * This function follows the same paradigm than it's generic version.
197205 *
198- * The generic version was converting int8 as it was a character
199- * (uint8_t is an alias to unsigned char on most compiler).
206+ * The generic version was converting char as it was a character
207+ * (unsigned char is an alias to unsigned char on most compiler).
200208 * Thus converting "1" would return 49 ie '1'.
201209 * As convertTo is thought as an _numerical_ convertion tool
202210 * (contrary to boost::lexical_cast for example),
203- * forbid considering the input as a character and consider uint8_t
211+ * forbid considering the input as a character and consider unsigned char
204212 * (aka unsigned char) as a number exclusively.
205213 *
206214 * @param[in] str the string to parse.
@@ -209,21 +217,20 @@ static inline bool convertTo(const std::string &str, T &result)
209217 * @return true if conversion was successful, false otherwise.
210218 */
211219template <>
212- inline bool convertTo<uint8_t >(const std::string &str, uint8_t &result)
220+ inline bool convertTo<unsigned char >(const std::string &str, unsigned char &result)
213221{
214- return details::convertToVia<uint8_t , uint32_t >(str, result);
222+ return details::convertToVia<unsigned char , unsigned int >(str, result);
215223}
216224
217- /* * Specialization for int8_t of convertTo template function.
225+ /* * Specialization for signed char of convertTo template function.
218226 *
219- * @see convertTo<uint8_t >
227+ * @see convertTo<unsigned char >
220228 */
221229template <>
222- inline bool convertTo<int8_t >(const std::string &str, int8_t &result)
230+ inline bool convertTo<signed char >(const std::string &str, signed char &result)
223231{
224- return details::convertToVia<int8_t , int32_t >(str, result);
232+ return details::convertToVia<signed char , int >(str, result);
225233}
226-
227234/* *
228235 * Specialization for float of convertTo template function.
229236 *
0 commit comments