from_chars.h
Go to the documentation of this file.
1 #pragma once
2 
11 #include <string>
12 #include <system_error>
13 
14 namespace cras
15 {
16 
18 {
19  scientific = 1 << 0,
20  fixed = 1 << 2,
21  hex = 1 << 3,
23 };
24 
26 {
27  const char* ptr;
28  ::std::errc ec;
29 };
30 
44 ::cras::from_chars_result from_chars(const char* first, const char* last, float& value,
46 
60 ::cras::from_chars_result from_chars(const char* first, const char* last, double& value,
62 
75 inline ::cras::from_chars_result from_chars(const ::std::string& string, float& value,
77 {
78  return ::cras::from_chars(string.data(), string.data() + string.size(), value, fmt);
79 }
80 
93 inline ::cras::from_chars_result from_chars(const ::std::string& string, double& value,
95 {
96  return ::cras::from_chars(string.data(), string.data() + string.size(), value, fmt);
97 }
98 
99 }
cras::from_chars_result::ec
::std::errc ec
Definition: from_chars.h:28
cras::from_chars_result
Definition: from_chars.h:25
cras::fixed
@ fixed
Definition: from_chars.h:20
cras
Definition: any.hpp:15
cras::general
@ general
Definition: from_chars.h:22
data
data
cras::from_chars
::cras::from_chars_result from_chars(const char *first, const char *last, float &value, ::cras::chars_format fmt=::cras::chars_format::general) noexcept
Convert the given string to its best float representation. The behavior is similar to std::from_chars...
cras::scientific
@ scientific
Definition: from_chars.h:19
cras::from_chars_result::ptr
const char * ptr
Definition: from_chars.h:27
cras::from_chars
inline ::cras::from_chars_result from_chars(const ::std::string &string, double &value, ::cras::chars_format fmt=::cras::chars_format::general) noexcept
Convert the given string to its best double representation. The behavior is similar to std::from_char...
Definition: from_chars.h:93
cras::hex
@ hex
Definition: from_chars.h:21
cras::chars_format
chars_format
Definition: from_chars.h:17


cras_cpp_common
Author(s): Martin Pecka
autogenerated on Tue Nov 26 2024 03:49:04