summaryrefslogtreecommitdiff
path: root/deimos/core/std.h
diff options
context:
space:
mode:
Diffstat (limited to 'deimos/core/std.h')
-rw-r--r--deimos/core/std.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/deimos/core/std.h b/deimos/core/std.h
index c789d95..89d7da5 100644
--- a/deimos/core/std.h
+++ b/deimos/core/std.h
@@ -5,10 +5,10 @@ using uint16_t = unsigned short;
using uint32_t = unsigned int;
using uint64_t = unsigned long long;
-using int8_t = char;
-using int16_t = short;
-using int32_t = int;
-using int64_t = long long;
+using int8_t = signed char;
+using int16_t = signed short;
+using int32_t = signed int;
+using int64_t = signed long long;
using size_t = uint64_t;
@@ -17,6 +17,10 @@ static_assert(sizeof(size_t) == sizeof(void*), "size_t should be pointer size");
namespace std
{
+template<typename T> concept integral = __is_integral(T);
+template<typename T> concept signed_integral = integral<T> && __is_signed(T);
+template<typename T> concept unsigned_integral = integral<T> && __is_unsigned(T);
+
template<typename T> constexpr bool is_trivially_destructible_v = __is_trivially_destructible(T);
template<typename U, typename V> constexpr bool _is_same_helper = false;
@@ -74,6 +78,20 @@ constexpr T exchange(T& obj, U&& new_value)
enum __attribute__((__may_alias__)) byte : uint8_t {};
static_assert(sizeof(byte) == 1, "");
+template<typename T>
+class initializer_list
+{
+ const T* m_begin = nullptr;
+ size_t m_size = 0;
+
+public:
+ constexpr initializer_list() noexcept = default;
+
+ constexpr size_t size() const noexcept { return m_size; }
+ constexpr const T* begin() const noexcept { return m_begin; }
+ constexpr const T* end() const noexcept { return m_begin + m_size; }
+};
+
} // namespace std
static_assert(std::same_as<int, int>, "");