ADTF  3.18.2
strings_convert_impl.h
Go to the documentation of this file.
1 
15 #ifndef A_UTIL_UTIL_STRINGS_DETAIL_STRINGS_CONVERT_IMPL_HEADER_INCLUDED
16 #define A_UTIL_UTIL_STRINGS_DETAIL_STRINGS_CONVERT_IMPL_HEADER_INCLUDED
17 
19 
20 namespace a_util {
21 namespace strings {
22 template <typename Numeric>
23 bool toNumeric(const char* from, Numeric& to)
24 {
25  return ToNumericConverter::convert(from, to);
26 }
27 
28 template <typename Numeric>
29 bool toNumeric(const std::string& from, Numeric& to)
30 {
31  return ToNumericConverter::convert(from.c_str(), to);
32 }
33 
34 template <typename Numeric>
35 Numeric toNumeric(const char* from)
36 {
37  Numeric to = Numeric();
39  return to;
40 }
41 
42 template <typename Numeric>
43 Numeric toNumeric(const std::string& from)
44 {
45  Numeric to = Numeric();
46  ToNumericConverter::convert(from.c_str(), to);
47  return to;
48 }
49 
50 } // namespace strings
51 } // namespace a_util
52 
53 #endif // A_UTIL_UTIL_STRINGS_DETAIL_STRINGS_CONVERT_IMPL_HEADER_INCLUDED
bool toNumeric(const char *from, Numeric &to)
Safely convert a string to a value of type Numeric in a generic manner.
Serves as the root component, with common functionality documented in core functionality.
Definition: base.h:24
Public API for string conversion functions.
static bool convert(const char *from, bool &to)
Safely convert a string to a boolean value.