mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-25 22:14:37 +00:00
Update STL headers
This commit is contained in:
parent
fd292305f6
commit
5a94744fd2
@ -32,6 +32,16 @@ namespace std
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class BidirIt1, class BidirIt2>
|
||||
BidirIt2 copy_backward(BidirIt1 first, BidirIt1 last, BidirIt2 d_last)
|
||||
{
|
||||
while (first != last)
|
||||
{
|
||||
*(--d_last) = *(--last);
|
||||
}
|
||||
return d_last;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void swap(T &a, T &b)
|
||||
{
|
||||
@ -65,6 +75,26 @@ namespace std
|
||||
: v;
|
||||
}
|
||||
|
||||
template <class ForwardIt1, class ForwardIt2>
|
||||
ForwardIt1 search(ForwardIt1 first, ForwardIt1 last,
|
||||
ForwardIt2 s_first, ForwardIt2 s_last)
|
||||
{
|
||||
for (; first != last; ++first)
|
||||
{
|
||||
ForwardIt1 it = first;
|
||||
for (ForwardIt2 s_it = s_first;; ++it, ++s_it)
|
||||
{
|
||||
if (s_it == s_last)
|
||||
return first;
|
||||
if (it == last)
|
||||
return last;
|
||||
if (!(*it == *s_it))
|
||||
break;
|
||||
}
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
template <class InputIt, class T>
|
||||
constexpr InputIt find(InputIt first, InputIt last, const T &value)
|
||||
{
|
||||
@ -95,6 +125,35 @@ namespace std
|
||||
return last;
|
||||
}
|
||||
|
||||
template <class ForwardIt1, class ForwardIt2>
|
||||
ForwardIt1 find_end(ForwardIt1 first, ForwardIt1 last,
|
||||
ForwardIt2 s_first, ForwardIt2 s_last)
|
||||
{
|
||||
if (s_first == s_last)
|
||||
return last;
|
||||
ForwardIt1 result = last;
|
||||
while (true)
|
||||
{
|
||||
ForwardIt1 new_result = std::search(first, last, s_first, s_last);
|
||||
if (new_result == last)
|
||||
return result;
|
||||
result = new_result;
|
||||
first = new_result;
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
template <class InputIt, class ForwardIt>
|
||||
InputIt find_first_of(InputIt first, InputIt last,
|
||||
ForwardIt s_first, ForwardIt s_last)
|
||||
{
|
||||
for (; first != last; ++first)
|
||||
for (ForwardIt it = s_first; it != s_last; ++it)
|
||||
if (*first == *it)
|
||||
return first;
|
||||
return last;
|
||||
}
|
||||
|
||||
template <class ForwardIt, class T>
|
||||
ForwardIt remove(ForwardIt first, ForwardIt last, const T &value)
|
||||
{
|
||||
@ -123,4 +182,15 @@ namespace std
|
||||
for (; first != last; ++first)
|
||||
*first = value;
|
||||
}
|
||||
|
||||
template <class OutputIt, class Size, class T>
|
||||
OutputIt fill_n(OutputIt first, Size count, const T &value)
|
||||
{
|
||||
for (Size i = 0; i < count; ++i)
|
||||
{
|
||||
*first = value;
|
||||
++first;
|
||||
}
|
||||
return first;
|
||||
}
|
||||
}
|
||||
|
75
include_std/cfloat
Normal file
75
include_std/cfloat
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
This file is part of Fennix Kernel.
|
||||
|
||||
Fennix Kernel is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix Kernel is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define INFINITY (__builtin_inff())
|
||||
#define NAN (__builtin_nanf(""))
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
|
||||
#define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
|
||||
#define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
|
||||
#define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
|
||||
|
||||
#define FLT_RADIX __FLT_RADIX__
|
||||
|
||||
#define FLT_MANT_DIG __FLT_MANT_DIG__
|
||||
#define DBL_MANT_DIG __DBL_MANT_DIG__
|
||||
#define LDBL_MANT_DIG __LDBL_MANT_DIG__
|
||||
|
||||
#define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
|
||||
#define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
|
||||
#define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
|
||||
|
||||
#define DECIMAL_DIG __DECIMAL_DIG__
|
||||
|
||||
#define FLT_DIG __FLT_DIG__
|
||||
#define DBL_DIG __DBL_DIG__
|
||||
#define LDBL_DIG __LDBL_DIG__
|
||||
|
||||
#define FLT_MIN_EXP __FLT_MIN_EXP__
|
||||
#define DBL_MIN_EXP __DBL_MIN_EXP__
|
||||
#define LDBL_MIN_EXP __LDBL_MIN_EXP__
|
||||
|
||||
#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
|
||||
#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
|
||||
#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
|
||||
|
||||
#define FLT_MAX_EXP __FLT_MAX_EXP__
|
||||
#define DBL_MAX_EXP __DBL_MAX_EXP__
|
||||
#define LDBL_MAX_EXP __LDBL_MAX_EXP__
|
||||
|
||||
#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
|
||||
#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
|
||||
#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
|
||||
|
||||
#define FLT_MAX __FLT_MAX__
|
||||
#define DBL_MAX __DBL_MAX__
|
||||
#define LDBL_MAX __LDBL_MAX__
|
||||
|
||||
#define FLT_EPSILON __FLT_EPSILON__
|
||||
#define DBL_EPSILON __DBL_EPSILON__
|
||||
#define LDBL_EPSILON __LDBL_EPSILON__
|
||||
|
||||
#define FLT_MIN __FLT_MIN__
|
||||
#define DBL_MIN __DBL_MIN__
|
||||
#define LDBL_MIN __LDBL_MIN__
|
||||
|
||||
#define FLT_TRUE_MIN __FLT_DENORM_MIN__
|
||||
#define DBL_TRUE_MIN __DBL_DENORM_MIN__
|
||||
#define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
|
56
include_std/climits
Normal file
56
include_std/climits
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
This file is part of Fennix Kernel.
|
||||
|
||||
Fennix Kernel is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix Kernel is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#undef CHAR_BIT
|
||||
#undef SCHAR_MIN
|
||||
#undef SCHAR_MAX
|
||||
#undef UCHAR_MAX
|
||||
#undef CHAR_MIN
|
||||
#undef CHAR_MAX
|
||||
#undef MB_LEN_MAX
|
||||
#undef SHRT_MIN
|
||||
#undef SHRT_MAX
|
||||
#undef USHRT_MAX
|
||||
#undef INT_MIN
|
||||
#undef INT_MAX
|
||||
#undef UINT_MAX
|
||||
#undef LONG_MIN
|
||||
#undef LONG_MAX
|
||||
#undef ULONG_MAX
|
||||
#undef LLONG_MIN
|
||||
#undef LLONG_MAX
|
||||
#undef ULLONG_MAX
|
||||
|
||||
#define CHAR_BIT __CHAR_BIT__
|
||||
#define SCHAR_MIN (-SCHAR_MAX - 1)
|
||||
#define SCHAR_MAX __SCHAR_MAX__
|
||||
#define UCHAR_MAX (SCHAR_MAX * 2 + 1)
|
||||
#define CHAR_MIN 0
|
||||
#define CHAR_MAX SCHAR_MAX
|
||||
#define MB_LEN_MAX 1
|
||||
#define SHRT_MIN (-SHRT_MAX - 1)
|
||||
#define SHRT_MAX __SHRT_MAX__
|
||||
#define USHRT_MAX (SHRT_MAX * 2 + 1)
|
||||
#define INT_MIN (-INT_MAX - 1)
|
||||
#define INT_MAX __INT_MAX__
|
||||
#define UINT_MAX (INT_MAX * 2U + 1U)
|
||||
#define LONG_MIN (-LONG_MAX - 1L)
|
||||
#define LONG_MAX __LONG_MAX__
|
||||
#define ULONG_MAX (LONG_MAX * 2UL + 1UL)
|
||||
#define LLONG_MIN (-LLONG_MAX - 1LL)
|
||||
#define LLONG_MAX __LONG_LONG_MAX__
|
||||
#define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
|
@ -19,6 +19,9 @@
|
||||
|
||||
namespace std
|
||||
{
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
||||
using nullptr_t = decltype(nullptr);
|
||||
}
|
||||
|
||||
static_assert(sizeof(std::nullptr_t) == sizeof(void *));
|
||||
|
85
include_std/iterator
Normal file
85
include_std/iterator
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
This file is part of Fennix Kernel.
|
||||
|
||||
Fennix Kernel is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix Kernel is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace std
|
||||
{
|
||||
struct input_iterator_tag
|
||||
{
|
||||
};
|
||||
|
||||
struct output_iterator_tag
|
||||
{
|
||||
};
|
||||
|
||||
struct forward_iterator_tag : public input_iterator_tag
|
||||
{
|
||||
};
|
||||
|
||||
struct bidirectional_iterator_tag : public forward_iterator_tag
|
||||
{
|
||||
};
|
||||
|
||||
struct random_access_iterator_tag : public bidirectional_iterator_tag
|
||||
{
|
||||
};
|
||||
|
||||
struct contiguous_iterator_tag : public random_access_iterator_tag
|
||||
{
|
||||
};
|
||||
|
||||
template <class Iter>
|
||||
class reverse_iterator
|
||||
{
|
||||
public:
|
||||
/* FIXME: missing implementation */
|
||||
};
|
||||
|
||||
template <class Iter>
|
||||
struct iterator_traits
|
||||
{
|
||||
public:
|
||||
typedef Iter::difference_type difference_type;
|
||||
|
||||
/* FIXME: missing implementation */
|
||||
};
|
||||
|
||||
template <class It>
|
||||
constexpr typename std::iterator_traits<It>::difference_type __do_distance(It first, It last, std::input_iterator_tag)
|
||||
{
|
||||
typename std::iterator_traits<It>::difference_type result = 0;
|
||||
while (first != last)
|
||||
{
|
||||
++first;
|
||||
++result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class It>
|
||||
constexpr typename std::iterator_traits<It>::difference_type __do_distance(It first, It last, std::random_access_iterator_tag)
|
||||
{
|
||||
return last - first;
|
||||
}
|
||||
|
||||
template <class InputIt>
|
||||
constexpr typename std::iterator_traits<InputIt>::difference_type distance(InputIt first, InputIt last)
|
||||
{
|
||||
return __do_distance(first, last, typename std::iterator_traits<InputIt>::iterator_category());
|
||||
}
|
||||
}
|
940
include_std/limits
Normal file
940
include_std/limits
Normal file
@ -0,0 +1,940 @@
|
||||
/*
|
||||
This file is part of Fennix Kernel.
|
||||
|
||||
Fennix Kernel is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix Kernel is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <climits>
|
||||
#include <cfloat>
|
||||
|
||||
namespace std
|
||||
{
|
||||
enum float_round_style
|
||||
{
|
||||
round_indeterminate = -1,
|
||||
round_toward_zero = 0,
|
||||
round_to_nearest = 1,
|
||||
round_toward_infinity = 2,
|
||||
round_toward_neg_infinity = 3,
|
||||
};
|
||||
|
||||
enum float_denorm_style
|
||||
{
|
||||
denorm_indeterminate = -1,
|
||||
denorm_absent = 0,
|
||||
denorm_present = 1
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class numeric_limits
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = false;
|
||||
|
||||
static constexpr T min() { return T(); }
|
||||
static constexpr T max() { return T(); }
|
||||
static constexpr T lowest() { return T(); }
|
||||
|
||||
static constexpr int digits = 0;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = false;
|
||||
static constexpr bool is_integer = false;
|
||||
static constexpr bool is_exact = false;
|
||||
static constexpr int radix = 0;
|
||||
static constexpr T epsilon() { return T(); }
|
||||
static constexpr T round_error() { return T(); }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr T infinity() { return T(); }
|
||||
static constexpr T quiet_NaN() { return T(); }
|
||||
static constexpr T signaling_NaN() { return T(); }
|
||||
static constexpr T denorm_min() { return T(); }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = false;
|
||||
static constexpr bool is_modulo = false;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<bool>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr bool min() { return false; }
|
||||
static constexpr bool max() { return true; }
|
||||
static constexpr bool lowest() { return false; }
|
||||
|
||||
static constexpr int digits = 1;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = false;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr bool epsilon() { return 0; }
|
||||
static constexpr bool round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr bool infinity() { return 0; }
|
||||
static constexpr bool quiet_NaN() { return 0; }
|
||||
static constexpr bool signaling_NaN() { return 0; }
|
||||
static constexpr bool denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = false;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<char>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr char min() { return CHAR_MIN; }
|
||||
static constexpr char max() { return CHAR_MAX; }
|
||||
static constexpr char lowest() { return CHAR_MIN; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = CHAR_MIN < 0;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr char epsilon() { return 0; }
|
||||
static constexpr char round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr char infinity() { return 0; }
|
||||
static constexpr char quiet_NaN() { return 0; }
|
||||
static constexpr char signaling_NaN() { return 0; }
|
||||
static constexpr char denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<signed char>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr signed char min() { return SCHAR_MIN; }
|
||||
static constexpr signed char max() { return SCHAR_MAX; }
|
||||
static constexpr signed char lowest() { return SCHAR_MIN; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT - 1;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = true;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr signed char epsilon() { return 0; }
|
||||
static constexpr signed char round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr signed char infinity() { return 0; }
|
||||
static constexpr signed char quiet_NaN() { return 0; }
|
||||
static constexpr signed char signaling_NaN() { return 0; }
|
||||
static constexpr signed char denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<unsigned char>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr unsigned char min() { return 0; }
|
||||
static constexpr unsigned char max() { return UCHAR_MAX; }
|
||||
static constexpr unsigned char lowest() { return 0; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = false;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr unsigned char epsilon() { return 0; }
|
||||
static constexpr unsigned char round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr unsigned char infinity() { return 0; }
|
||||
static constexpr unsigned char quiet_NaN() { return 0; }
|
||||
static constexpr unsigned char signaling_NaN() { return 0; }
|
||||
static constexpr unsigned char denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<wchar_t>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr wchar_t min() { return __WCHAR_MIN__; }
|
||||
static constexpr wchar_t max() { return __WCHAR_MAX__; }
|
||||
static constexpr wchar_t lowest() { return __WCHAR_MIN__; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT * sizeof(wchar_t) - 1;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = __WCHAR_MIN__ < 0;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr wchar_t epsilon() { return 0; }
|
||||
static constexpr wchar_t round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr wchar_t infinity() { return 0; }
|
||||
static constexpr wchar_t quiet_NaN() { return 0; }
|
||||
static constexpr wchar_t signaling_NaN() { return 0; }
|
||||
static constexpr wchar_t denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<char8_t>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr char8_t min() { return 0; }
|
||||
static constexpr char8_t max() { return UCHAR_MAX; }
|
||||
static constexpr char8_t lowest() { return 0; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = false;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr char8_t epsilon() { return 0; }
|
||||
static constexpr char8_t round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr char8_t infinity() { return 0; }
|
||||
static constexpr char8_t quiet_NaN() { return 0; }
|
||||
static constexpr char8_t signaling_NaN() { return 0; }
|
||||
static constexpr char8_t denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<char16_t>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr char16_t min() { return 0; }
|
||||
static constexpr char16_t max() { return USHRT_MAX; }
|
||||
static constexpr char16_t lowest() { return 0; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT * sizeof(char16_t) - 1;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = false;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr char16_t epsilon() { return 0; }
|
||||
static constexpr char16_t round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr char16_t infinity() { return 0; }
|
||||
static constexpr char16_t quiet_NaN() { return 0; }
|
||||
static constexpr char16_t signaling_NaN() { return 0; }
|
||||
static constexpr char16_t denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<char32_t>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr char32_t min() { return 0; }
|
||||
static constexpr char32_t max() { return UINT_MAX; }
|
||||
static constexpr char32_t lowest() { return 0; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT * sizeof(char32_t) - 1;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = false;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr char32_t epsilon() { return 0; }
|
||||
static constexpr char32_t round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr char32_t infinity() { return 0; }
|
||||
static constexpr char32_t quiet_NaN() { return 0; }
|
||||
static constexpr char32_t signaling_NaN() { return 0; }
|
||||
static constexpr char32_t denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<short>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr short min() { return SHRT_MIN; }
|
||||
static constexpr short max() { return SHRT_MAX; }
|
||||
static constexpr short lowest() { return SHRT_MIN; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT * sizeof(short) - 1;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = true;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr short epsilon() { return 0; }
|
||||
static constexpr short round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr short infinity() { return 0; }
|
||||
static constexpr short quiet_NaN() { return 0; }
|
||||
static constexpr short signaling_NaN() { return 0; }
|
||||
static constexpr short denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<unsigned short>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr unsigned short min() { return 0; }
|
||||
static constexpr unsigned short max() { return USHRT_MAX; }
|
||||
static constexpr unsigned short lowest() { return 0; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT * sizeof(unsigned short);
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = false;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr unsigned short epsilon() { return 0; }
|
||||
static constexpr unsigned short round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr unsigned short infinity() { return 0; }
|
||||
static constexpr unsigned short quiet_NaN() { return 0; }
|
||||
static constexpr unsigned short signaling_NaN() { return 0; }
|
||||
static constexpr unsigned short denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<int>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr int min() { return INT_MIN; }
|
||||
static constexpr int max() { return INT_MAX; }
|
||||
static constexpr int lowest() { return INT_MIN; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT * sizeof(int) - 1;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = true;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr int epsilon() { return 0; }
|
||||
static constexpr int round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr int infinity() { return 0; }
|
||||
static constexpr int quiet_NaN() { return 0; }
|
||||
static constexpr int signaling_NaN() { return 0; }
|
||||
static constexpr int denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<unsigned int>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr unsigned int min() { return 0; }
|
||||
static constexpr unsigned int max() { return UINT_MAX; }
|
||||
static constexpr unsigned int lowest() { return 0; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT * sizeof(unsigned int);
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = false;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr unsigned int epsilon() { return 0; }
|
||||
static constexpr unsigned int round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr unsigned int infinity() { return 0; }
|
||||
static constexpr unsigned int quiet_NaN() { return 0; }
|
||||
static constexpr unsigned int signaling_NaN() { return 0; }
|
||||
static constexpr unsigned int denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<long>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr long min() { return LONG_MIN; }
|
||||
static constexpr long max() { return LONG_MAX; }
|
||||
static constexpr long lowest() { return LONG_MIN; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT * sizeof(long) - 1;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = true;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr long epsilon() { return 0; }
|
||||
static constexpr long round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr long infinity() { return 0; }
|
||||
static constexpr long quiet_NaN() { return 0; }
|
||||
static constexpr long signaling_NaN() { return 0; }
|
||||
static constexpr long denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<unsigned long>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr unsigned long min() { return 0; }
|
||||
static constexpr unsigned long max() { return ULONG_MAX; }
|
||||
static constexpr unsigned long lowest() { return 0; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT * sizeof(unsigned long);
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = false;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr unsigned long epsilon() { return 0; }
|
||||
static constexpr unsigned long round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr unsigned long infinity() { return 0; }
|
||||
static constexpr unsigned long quiet_NaN() { return 0; }
|
||||
static constexpr unsigned long signaling_NaN() { return 0; }
|
||||
static constexpr unsigned long denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<long long>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr long long min() { return LLONG_MIN; }
|
||||
static constexpr long long max() { return LLONG_MAX; }
|
||||
static constexpr long long lowest() { return LLONG_MIN; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT * sizeof(long long) - 1;
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = true;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr long long epsilon() { return 0; }
|
||||
static constexpr long long round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr long long infinity() { return 0; }
|
||||
static constexpr long long quiet_NaN() { return 0; }
|
||||
static constexpr long long signaling_NaN() { return 0; }
|
||||
static constexpr long long denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<unsigned long long>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr unsigned long long min() { return 0; }
|
||||
static constexpr unsigned long long max() { return ULLONG_MAX; }
|
||||
static constexpr unsigned long long lowest() { return 0; }
|
||||
|
||||
static constexpr int digits = CHAR_BIT * sizeof(unsigned long long);
|
||||
static constexpr int digits10 = 0;
|
||||
static constexpr int max_digits10 = 0;
|
||||
|
||||
static constexpr bool is_signed = false;
|
||||
static constexpr bool is_integer = true;
|
||||
static constexpr bool is_exact = true;
|
||||
static constexpr int radix = 2;
|
||||
static constexpr unsigned long long epsilon() { return 0; }
|
||||
static constexpr unsigned long long round_error() { return 0; }
|
||||
|
||||
static constexpr int min_exponent = 0;
|
||||
static constexpr int min_exponent10 = 0;
|
||||
static constexpr int max_exponent = 0;
|
||||
static constexpr int max_exponent10 = 0;
|
||||
|
||||
static constexpr bool has_infinity = false;
|
||||
static constexpr bool has_quiet_NaN = false;
|
||||
static constexpr bool has_signaling_NaN = false;
|
||||
static constexpr float_denorm_style has_denorm = denorm_absent;
|
||||
static constexpr bool has_denorm_loss = false;
|
||||
static constexpr unsigned long long infinity() { return 0; }
|
||||
static constexpr unsigned long long quiet_NaN() { return 0; }
|
||||
static constexpr unsigned long long signaling_NaN() { return 0; }
|
||||
static constexpr unsigned long long denorm_min() { return 0; }
|
||||
|
||||
static constexpr bool is_iec559 = false;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = true;
|
||||
|
||||
static constexpr bool traps = false;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<float>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr float min() { return FLT_MIN; }
|
||||
static constexpr float max() { return FLT_MAX; }
|
||||
static constexpr float lowest() { return -FLT_MAX; }
|
||||
|
||||
static constexpr int digits = FLT_MANT_DIG;
|
||||
static constexpr int digits10 = FLT_DIG;
|
||||
static constexpr int max_digits10 = FLT_DECIMAL_DIG;
|
||||
|
||||
static constexpr bool is_signed = true;
|
||||
static constexpr bool is_integer = false;
|
||||
static constexpr bool is_exact = false;
|
||||
static constexpr int radix = FLT_RADIX;
|
||||
static constexpr float epsilon() { return FLT_EPSILON; }
|
||||
static constexpr float round_error() { return 0.5f; }
|
||||
|
||||
static constexpr int min_exponent = FLT_MIN_EXP;
|
||||
static constexpr int min_exponent10 = FLT_MIN_10_EXP;
|
||||
static constexpr int max_exponent = FLT_MAX_EXP;
|
||||
static constexpr int max_exponent10 = FLT_MAX_10_EXP;
|
||||
|
||||
static constexpr bool has_infinity = true;
|
||||
static constexpr bool has_quiet_NaN = true;
|
||||
static constexpr bool has_signaling_NaN = true;
|
||||
static constexpr float_denorm_style has_denorm = denorm_present;
|
||||
static constexpr bool has_denorm_loss = true;
|
||||
static constexpr float infinity() { return INFINITY; }
|
||||
static constexpr float quiet_NaN() { return NAN; }
|
||||
static constexpr float signaling_NaN() { return NAN; }
|
||||
static constexpr float denorm_min() { return FLT_TRUE_MIN; }
|
||||
|
||||
static constexpr bool is_iec559 = true;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = false;
|
||||
|
||||
static constexpr bool traps = true;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_to_nearest;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<double>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr double min() { return DBL_MIN; }
|
||||
static constexpr double max() { return DBL_MAX; }
|
||||
static constexpr double lowest() { return -DBL_MAX; }
|
||||
|
||||
static constexpr int digits = DBL_MANT_DIG;
|
||||
static constexpr int digits10 = DBL_DIG;
|
||||
static constexpr int max_digits10 = DBL_DECIMAL_DIG;
|
||||
|
||||
static constexpr bool is_signed = true;
|
||||
static constexpr bool is_integer = false;
|
||||
static constexpr bool is_exact = false;
|
||||
static constexpr int radix = FLT_RADIX;
|
||||
static constexpr double epsilon() { return DBL_EPSILON; }
|
||||
static constexpr double round_error() { return 0.5; }
|
||||
|
||||
static constexpr int min_exponent = DBL_MIN_EXP;
|
||||
static constexpr int min_exponent10 = DBL_MIN_10_EXP;
|
||||
static constexpr int max_exponent = DBL_MAX_EXP;
|
||||
static constexpr int max_exponent10 = DBL_MAX_10_EXP;
|
||||
|
||||
static constexpr bool has_infinity = true;
|
||||
static constexpr bool has_quiet_NaN = true;
|
||||
static constexpr bool has_signaling_NaN = true;
|
||||
static constexpr float_denorm_style has_denorm = denorm_present;
|
||||
static constexpr bool has_denorm_loss = true;
|
||||
static constexpr double infinity() { return INFINITY; }
|
||||
static constexpr double quiet_NaN() { return NAN; }
|
||||
static constexpr double signaling_NaN() { return NAN; }
|
||||
static constexpr double denorm_min() { return DBL_TRUE_MIN; }
|
||||
|
||||
static constexpr bool is_iec559 = true;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = false;
|
||||
|
||||
static constexpr bool traps = true;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_to_nearest;
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<long double>
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_specialized = true;
|
||||
|
||||
static constexpr long double min() { return LDBL_MIN; }
|
||||
static constexpr long double max() { return LDBL_MAX; }
|
||||
static constexpr long double lowest() { return -LDBL_MAX; }
|
||||
|
||||
static constexpr int digits = LDBL_MANT_DIG;
|
||||
static constexpr int digits10 = LDBL_DIG;
|
||||
static constexpr int max_digits10 = LDBL_DECIMAL_DIG;
|
||||
|
||||
static constexpr bool is_signed = true;
|
||||
static constexpr bool is_integer = false;
|
||||
static constexpr bool is_exact = false;
|
||||
static constexpr int radix = FLT_RADIX;
|
||||
static constexpr long double epsilon() { return LDBL_EPSILON; }
|
||||
static constexpr long double round_error() { return 0.5L; }
|
||||
|
||||
static constexpr int min_exponent = LDBL_MIN_EXP;
|
||||
static constexpr int min_exponent10 = LDBL_MIN_10_EXP;
|
||||
static constexpr int max_exponent = LDBL_MAX_EXP;
|
||||
static constexpr int max_exponent10 = LDBL_MAX_10_EXP;
|
||||
|
||||
static constexpr bool has_infinity = true;
|
||||
static constexpr bool has_quiet_NaN = true;
|
||||
static constexpr bool has_signaling_NaN = true;
|
||||
static constexpr float_denorm_style has_denorm = denorm_present;
|
||||
static constexpr bool has_denorm_loss = true;
|
||||
static constexpr long double infinity() { return INFINITY; }
|
||||
static constexpr long double quiet_NaN() { return NAN; }
|
||||
static constexpr long double signaling_NaN() { return NAN; }
|
||||
static constexpr long double denorm_min() { return LDBL_TRUE_MIN; }
|
||||
|
||||
static constexpr bool is_iec559 = true;
|
||||
static constexpr bool is_bounded = true;
|
||||
static constexpr bool is_modulo = false;
|
||||
|
||||
static constexpr bool traps = true;
|
||||
static constexpr bool tinyness_before = false;
|
||||
static constexpr float_round_style round_style = round_to_nearest;
|
||||
};
|
||||
}
|
108
include_std/memory
Normal file
108
include_std/memory
Normal file
@ -0,0 +1,108 @@
|
||||
/*
|
||||
This file is part of Fennix Kernel.
|
||||
|
||||
Fennix Kernel is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix Kernel is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
#include <limits>
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <class Pointer, class SizeType = std::size_t>
|
||||
struct allocation_result
|
||||
{
|
||||
Pointer ptr;
|
||||
SizeType count;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct allocator
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef T *pointer;
|
||||
typedef const T *const_pointer;
|
||||
typedef T &reference;
|
||||
typedef const T &const_reference;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef std::true_type propagate_on_container_move_assignment;
|
||||
typedef std::true_type is_always_equal;
|
||||
|
||||
template <class U>
|
||||
struct rebind
|
||||
{
|
||||
typedef allocator<U> other;
|
||||
};
|
||||
|
||||
allocator() {}
|
||||
allocator(const allocator &other) {}
|
||||
template <class U>
|
||||
allocator(const allocator<U> &other) {}
|
||||
~allocator() {}
|
||||
|
||||
pointer allocate(size_type n, const void *hint = 0)
|
||||
{
|
||||
return static_cast<pointer>(::operator new(n * sizeof(T)));
|
||||
}
|
||||
|
||||
std::allocation_result<T *, std::size_t> allocate_at_least(std::size_t n)
|
||||
{
|
||||
if (n > max_size())
|
||||
return {nullptr, 0};
|
||||
return {allocate(n), n};
|
||||
}
|
||||
|
||||
void deallocate(T *p, std::size_t n)
|
||||
{
|
||||
::operator delete(p);
|
||||
}
|
||||
|
||||
size_type max_size() const
|
||||
{
|
||||
return std::numeric_limits<size_type>::max() / sizeof(T);
|
||||
}
|
||||
|
||||
void construct(pointer p, const_reference val)
|
||||
{
|
||||
::new ((void *)p) T(val);
|
||||
}
|
||||
|
||||
template <class U, class... Args>
|
||||
void construct(U *p, Args &&...args)
|
||||
{
|
||||
::new ((void *)p) U(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
void destroy(pointer p) { p->~T(); }
|
||||
template <class U>
|
||||
void destroy(U *p) { p->~U(); }
|
||||
pointer address(reference x) const { return &x; }
|
||||
const_pointer address(const_reference x) const { return &x; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
T *addressof(T &arg)
|
||||
{
|
||||
return reinterpret_cast<T *>(&const_cast<char &>(reinterpret_cast<const volatile char &>(arg)));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const T *addressof(const T &&) = delete;
|
||||
}
|
@ -25,7 +25,6 @@
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
struct defer_lock_t
|
||||
{
|
||||
explicit defer_lock_t() = default;
|
||||
|
28
include_std/ranges
Normal file
28
include_std/ranges
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
This file is part of Fennix Kernel.
|
||||
|
||||
Fennix Kernel is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix Kernel is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace std
|
||||
{
|
||||
struct from_range_t
|
||||
{
|
||||
explicit from_range_t() = default;
|
||||
};
|
||||
|
||||
inline constexpr std::from_range_t from_range{};
|
||||
}
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
#include <type_trails>
|
||||
#include <type_traits>
|
||||
#include <debug.h>
|
||||
|
||||
// show debug messages
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
namespace std
|
||||
{
|
||||
class runtime_error
|
||||
@ -28,4 +30,14 @@ namespace std
|
||||
runtime_error(const char *what_arg) : m_what(what_arg) {}
|
||||
const char *what() const { return this->m_what; }
|
||||
};
|
||||
|
||||
class out_of_range
|
||||
{
|
||||
public:
|
||||
out_of_range(const char *what_arg)
|
||||
{
|
||||
/* FIXME: This is a temporary assert */
|
||||
assert(what_arg != nullptr);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -42,4 +42,17 @@ namespace std
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <class T, T v>
|
||||
struct integral_constant
|
||||
{
|
||||
static constexpr T value = v;
|
||||
typedef T value_type;
|
||||
typedef integral_constant type;
|
||||
constexpr operator value_type() const noexcept { return value; }
|
||||
constexpr value_type operator()() const noexcept { return value; }
|
||||
};
|
||||
|
||||
typedef integral_constant<bool, true> true_type;
|
||||
typedef integral_constant<bool, false> false_type;
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_trails>
|
||||
#include <type_traits>
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
#include <type_trails>
|
||||
#include <type_traits>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user