39 CSV_CONST CONSTEXPR_14
40 long double pow10(
const T& n)
noexcept {
56 CSV_CONST CONSTEXPR_14
57 long double pow10(
const unsigned& n)
noexcept {
61 for (
unsigned i = 0; i < n; i++) {
68#ifndef DOXYGEN_SHOULD_SKIP_THIS
83 static_assert(std::is_integral<T>::value,
"T should be an integral type.");
84 static_assert(
sizeof(
T) <= 8,
"Byte size must be no greater than 8.");
104 template<
size_t Bytes>
107 "Bytes must be a power of 2 below 8.");
110 return (
long double)std::numeric_limits<signed char>::max();
113 return (
long double)std::numeric_limits<short>::max();
116 return (
long double)std::numeric_limits<int>::max();
119 return (
long double)std::numeric_limits<long int>::max();
122 return (
long double)std::numeric_limits<long long int>::max();
129 template<
size_t Bytes>
132 "Bytes must be a power of 2 below 8.");
135 return (
long double)std::numeric_limits<unsigned char>::max();
138 return (
long double)std::numeric_limits<unsigned short>::max();
141 return (
long double)std::numeric_limits<unsigned int>::max();
144 return (
long double)std::numeric_limits<unsigned long int>::max();
147 return (
long double)std::numeric_limits<unsigned long long int>::max();
179 CSV_PRIVATE CONSTEXPR_14
182 const long double&
coeff,
183 long double *
const out) {
199 CSV_PRIVATE CSV_PURE CONSTEXPR_14
246 for (
size_t i = 0,
ilen =
in.size(); i <
ilen; i++) {
286 if (
in[i + 1] ==
'+') {
A standalone header file containing shared code.
#define IF_CONSTEXPR
Expands to if constexpr in C++17 and if otherwise.
CONSTEXPR_VALUE_14 long double CSV_INT16_MAX
Largest number that can be stored in a 16-bit integer.
CONSTEXPR_VALUE_14 long double CSV_INT32_MAX
Largest number that can be stored in a 32-bit integer.
CONSTEXPR_VALUE_14 long double CSV_UINT16_MAX
Largest number that can be stored in a 16-bit unsigned integer.
CONSTEXPR_14 DataType data_type(csv::string_view in, long double *const out, const char decimalSymbol)
Distinguishes numeric from other text values.
CONSTEXPR_VALUE_14 long double CSV_UINT32_MAX
Largest number that can be stored in a 32-bit unsigned integer.
CSV_CONST CONSTEXPR_14 long double pow10(const T &n) noexcept
Compute 10 to the power of n.
CONSTEXPR_VALUE_14 long double CSV_INT64_MAX
Largest number that can be stored in a 64-bit integer.
CONSTEXPR_VALUE_14 long double CSV_INT8_MAX
Largest number that can be stored in a 8-bit integer.
CONSTEXPR_VALUE_14 long double CSV_UINT64_MAX
Largest number that can be stored in a 64-bit unsigned integer.
CONSTEXPR_VALUE_14 long double CSV_UINT8_MAX
Largest number that can be stored in a 8-bit ungisned integer.
CSV_CONST CONSTEXPR_17 OutArray arrayToDefault(T &&value)
Helper constexpr function to initialize an array with all the elements set to value.
CONSTEXPR_14 long double get_uint_max()
Given a byte size, return the largest number than can be stored in an unsigned integer of that size.
CSV_PRIVATE CONSTEXPR_14 DataType _process_potential_exponential(csv::string_view exponential_part, const long double &coeff, long double *const out)
Given a pointer to the start of what is start of the exponential part of a number written (possibly) ...
CONSTEXPR_14 long double get_int_max()
Given a byte size, return the largest number than can be stored in an integer of that size.
CSV_PRIVATE CSV_PURE CONSTEXPR_14 DataType _determine_integral_type(const long double &number) noexcept
Given the absolute value of an integer, determine what numeric type it fits in.
The all encompassing namespace.
DataType
Enumerates the different CSV field types that are recognized by this library.
@ CSV_INT64
64-bit integer (long long on MSVC/GCC)
@ CSV_DOUBLE
Floating point value.
@ CSV_BIGINT
Value too big to fit in a 64-bit in.
@ CSV_INT16
16-bit integer (short on MSVC/GCC)
@ CSV_INT32
32-bit integer (int on MSVC/GCC)
@ CSV_STRING
Non-numeric string.
nonstd::string_view string_view
The string_view class used by this library.