Compare commits
4 Commits
ea722ec5bf
...
73a50cae0f
| Author | SHA1 | Date | |
|---|---|---|---|
| 73a50cae0f | |||
| 91398ef23d | |||
| b5ecd73b18 | |||
| 826f3a54b3 |
@ -4,9 +4,9 @@
|
||||
|
||||
/*
|
||||
*
|
||||
* Disclaimer: Probably very bad implementation of some features of the C++
|
||||
* Standard Library. Not meant as a full-on stdlib implementation, only for
|
||||
* usage in this project (Underlined by the fact, that in this case the
|
||||
* Disclaimer: Very bad (partially at least) implementation of some features of
|
||||
* the C++ Standard Library. Not meant as a full-on stdlib implementation, only
|
||||
* for usage in this project (Underlined by the fact, that in this case the
|
||||
* namespace std is actually const_fmt::std)
|
||||
*
|
||||
*/
|
||||
@ -36,25 +36,71 @@ using size_t = uint16_t;
|
||||
*/
|
||||
|
||||
|
||||
struct true_type {
|
||||
constexpr static bool value = true;
|
||||
};
|
||||
|
||||
struct false_type {
|
||||
constexpr static bool value = false;
|
||||
};
|
||||
|
||||
|
||||
// clang-format off
|
||||
|
||||
template<typename T>
|
||||
struct remove_reference {
|
||||
using type = T;
|
||||
};
|
||||
template<typename T>
|
||||
struct remove_reference<T &> {
|
||||
using type = T;
|
||||
};
|
||||
template<typename T>
|
||||
struct remove_reference<T &&> {
|
||||
using type = T;
|
||||
};
|
||||
template <typename type_t> struct remove_cv { typedef type_t type; };
|
||||
template <typename type_t> struct remove_cv<const type_t> { typedef type_t type; };
|
||||
template <typename type_t> struct remove_cv<volatile type_t> { typedef type_t type; };
|
||||
template <typename type_t> struct remove_cv<const volatile type_t> { typedef type_t type; };
|
||||
|
||||
template<typename T>
|
||||
using remove_reference_t = typename std::remove_reference<T>::type;
|
||||
template <typename type_t> struct remove_const { typedef type_t type; };
|
||||
template <typename type_t> struct remove_const<const type_t> { typedef type_t type; };
|
||||
|
||||
template <typename type_t> struct remove_volatile { typedef type_t type; };
|
||||
template <typename type_t> struct remove_volatile<volatile type_t> { typedef type_t type; };
|
||||
|
||||
template <typename type_t> struct remove_reference { using type = type_t; };
|
||||
template <typename type_t> struct remove_reference<type_t &> { using type = type_t; };
|
||||
template <typename type_t> struct remove_reference<type_t &&> { using type = type_t; };
|
||||
|
||||
template <typename type_t> using remove_reference_t = typename std::remove_reference<type_t>::type;
|
||||
template <typename type_t> using remove_cv_t = typename std::remove_cv<type_t>::type;
|
||||
template <typename type_t> using remove_const_t = typename std::remove_const<type_t>::type;
|
||||
template <typename type_t> using remove_volatile_t = typename std::remove_volatile<type_t>::type;
|
||||
|
||||
|
||||
template <typename> struct is_integral_helper : public false_type {};
|
||||
|
||||
template <> struct is_integral_helper<bool> : public true_type {};
|
||||
template <> struct is_integral_helper<char> : public true_type {};
|
||||
template <> struct is_integral_helper<signed char> : public true_type {};
|
||||
template <> struct is_integral_helper<unsigned char> : public true_type {};
|
||||
template <> struct is_integral_helper<wchar_t> : public true_type {};
|
||||
template <> struct is_integral_helper<char16_t> : public true_type {};
|
||||
template <> struct is_integral_helper<char32_t> : public true_type {};
|
||||
template <> struct is_integral_helper<short> : public true_type {};
|
||||
template <> struct is_integral_helper<unsigned short> : public true_type {};
|
||||
template <> struct is_integral_helper<int> : public true_type {};
|
||||
template <> struct is_integral_helper<unsigned int> : public true_type {};
|
||||
template <> struct is_integral_helper<long> : public true_type {};
|
||||
template <> struct is_integral_helper<unsigned long> : public true_type {};
|
||||
template <> struct is_integral_helper<long long> : public true_type {};
|
||||
template <> struct is_integral_helper<unsigned long long> : public true_type {};
|
||||
|
||||
template <typename type_t>
|
||||
struct is_integral
|
||||
: public is_integral_helper<remove_cv_t<type_t>> {};
|
||||
|
||||
|
||||
template <typename> struct is_floating_point_helper : public false_type {};
|
||||
|
||||
template<> struct is_floating_point_helper<float> : public true_type {};
|
||||
template<> struct is_floating_point_helper<double> : public true_type {};
|
||||
template<> struct is_floating_point_helper<long double> : public true_type {};
|
||||
|
||||
template<typename _Tp>
|
||||
struct is_floating_point
|
||||
: public is_floating_point_helper<remove_cv_t<_Tp>>::type {};
|
||||
|
||||
// clang-format on
|
||||
|
||||
|
||||
constexpr inline bool is_constant_evaluated() noexcept {
|
||||
@ -62,8 +108,6 @@ constexpr inline bool is_constant_evaluated() noexcept {
|
||||
}
|
||||
|
||||
|
||||
// clang-format off
|
||||
|
||||
template <typename type_t> struct make_unsigned { using type = type_t; };
|
||||
|
||||
template <> struct make_unsigned<signed char> { using type = char; };
|
||||
@ -82,17 +126,17 @@ template <> struct make_unsigned<signed long long> { using type = unsigned long
|
||||
*/
|
||||
|
||||
|
||||
//template <typename _Tp>
|
||||
//concept integral = is_integral_v<_Tp>;
|
||||
// template <typename _Tp>
|
||||
// concept integral = is_integral_v<_Tp>;
|
||||
//
|
||||
//template <typename _Tp>
|
||||
//concept signed_integral = integral<_Tp> && is_signed_v<_Tp>;
|
||||
// template <typename _Tp>
|
||||
// concept signed_integral = integral<_Tp> && is_signed_v<_Tp>;
|
||||
//
|
||||
//template <typename _Tp>
|
||||
//concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
|
||||
// template <typename _Tp>
|
||||
// concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
|
||||
//
|
||||
//template <typename _Tp>
|
||||
//concept floating_point = is_floating_point_v<_Tp>;
|
||||
// template <typename _Tp>
|
||||
// concept floating_point = is_floating_point_v<_Tp>;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user