/// assertd(expr, desc)
@@ -65,15 +70,20 @@
using assert_handler = void (*)(const char *, const char *, int , const char *);
-void __assert_impl(const char* expression, const char* file, int line, const char* function, const char* desc);
+void __assert_impl(const char* expression, const char* file, int line, const char* function, const char* desc, bool halt);
// flagged unlikely to optimize branch prediction
#define assert(expression, description) \
if(not(expression)) [[unlikely]] { \
- __assert_impl(#expression, __FILE__, __LINE__, __PRETTY_FUNCTION__, description); \
+ __assert_impl(#expression, __FILE__, __LINE__, __PRETTY_FUNCTION__, description, not FENNEC_RELEASE); \
}
-#ifdef NDEBUG
+#define assertf(expression, description) \
+ if(not(expression)) [[unlikely]] { \
+ __assert_impl(#expression, __FILE__, __LINE__, __PRETTY_FUNCTION__, description, true); \
+ }
+
+#if FENNEC_RELEASE
#define assertd(expression, description) (0)
#else
#define assertd(expression, description) assert(expression, description)
diff --git a/include/fennec/lang/conditional_types.h b/include/fennec/lang/conditional_types.h
index 73525f4..e38613a 100644
--- a/include/fennec/lang/conditional_types.h
+++ b/include/fennec/lang/conditional_types.h
@@ -32,6 +32,8 @@
#ifndef FENNEC_LANG_CONDITIONAL_TYPES_H
#define FENNEC_LANG_CONDITIONAL_TYPES_H
+#include
+
///
/// \page fennec_lang_conditional_types Conditional Types
///
@@ -64,8 +66,6 @@
///
///
-#include
-
namespace fennec
{
@@ -92,12 +92,12 @@ using conditional_t
// specialization of fennec::conditional for `true` case
template
-struct conditional : type_transform{};
+struct conditional : type_identity{};
// specialization of fennec::conditional for `false` case
template
-struct conditional : type_transform{};
+struct conditional : type_identity{};
// fennec::detect ======================================================================================================
diff --git a/include/fennec/lang/detail/__numeric_transforms.h b/include/fennec/lang/detail/__numeric_transforms.h
index 69a840e..9cc134a 100644
--- a/include/fennec/lang/detail/__numeric_transforms.h
+++ b/include/fennec/lang/detail/__numeric_transforms.h
@@ -28,34 +28,34 @@ namespace fennec
namespace detail
{
-template struct __make_unsigned : type_transform {};
+template struct __make_unsigned : type_identity {};
-template<> struct __make_unsigned : type_transform {};
-template<> struct __make_unsigned : type_transform {};
-template<> struct __make_unsigned : type_transform {};
-template<> struct __make_unsigned : type_transform {};
-template<> struct __make_unsigned : type_transform {};
-template<> struct __make_unsigned : type_transform {};
-template<> struct __make_unsigned : type_transform {};
-template<> struct __make_unsigned : type_transform {};
-template<> struct __make_unsigned : type_transform {};
-template<> struct __make_unsigned : type_transform {};
-template<> struct __make_unsigned : type_transform {};
+template<> struct __make_unsigned : type_identity {};
+template<> struct __make_unsigned : type_identity {};
+template<> struct __make_unsigned : type_identity {};
+template<> struct __make_unsigned : type_identity {};
+template<> struct __make_unsigned : type_identity {};
+template<> struct __make_unsigned : type_identity {};
+template<> struct __make_unsigned : type_identity {};
+template<> struct __make_unsigned : type_identity {};
+template<> struct __make_unsigned : type_identity {};
+template<> struct __make_unsigned : type_identity {};
+template<> struct __make_unsigned : type_identity {};
-template struct __make_signed : type_transform {};
+template struct __make_signed : type_identity {};
-template<> struct __make_signed : type_transform {};
-template<> struct __make_signed : type_transform {};
-template<> struct __make_signed : type_transform {};
-template<> struct __make_signed : type_transform {};
-template<> struct __make_signed : type_transform {};
-template<> struct __make_signed : type_transform {};
-template<> struct __make_signed : type_transform {};
-template<> struct __make_signed : type_transform {};
-template<> struct __make_signed : type_transform {};
-template<> struct __make_signed : type_transform {};
-template<> struct __make_signed : type_transform {};
+template<> struct __make_signed : type_identity {};
+template<> struct __make_signed : type_identity {};
+template<> struct __make_signed : type_identity {};
+template<> struct __make_signed : type_identity {};
+template<> struct __make_signed : type_identity {};
+template<> struct __make_signed : type_identity {};
+template<> struct __make_signed : type_identity {};
+template<> struct __make_signed : type_identity {};
+template<> struct __make_signed : type_identity {};
+template<> struct __make_signed : type_identity {};
+template<> struct __make_signed : type_identity {};
}
diff --git a/include/fennec/lang/detail/__type_sequences.h b/include/fennec/lang/detail/__type_sequences.h
index 848521e..fe13156 100644
--- a/include/fennec/lang/detail/__type_sequences.h
+++ b/include/fennec/lang/detail/__type_sequences.h
@@ -27,7 +27,7 @@ namespace fennec
namespace detail
{
-template struct __first_element : type_transform{};
+template struct __first_element : type_identity{};
}
diff --git a/include/fennec/lang/detail/__type_traits.h b/include/fennec/lang/detail/__type_traits.h
index 1d731f8..c6bb455 100644
--- a/include/fennec/lang/detail/__type_traits.h
+++ b/include/fennec/lang/detail/__type_traits.h
@@ -65,6 +65,9 @@ template struct __is_floating_point : false_type {};
template<> struct __is_floating_point : true_type {};
template<> struct __is_floating_point : true_type {};
+template struct __is_pointer : false_type {};
+template struct __is_pointer : true_type {};
+
}
}
diff --git a/include/fennec/lang/detail/__type_transforms.h b/include/fennec/lang/detail/__type_transforms.h
new file mode 100644
index 0000000..a518af2
--- /dev/null
+++ b/include/fennec/lang/detail/__type_transforms.h
@@ -0,0 +1,55 @@
+// =====================================================================================================================
+// fennec, a free and open source game engine
+// Copyright © 2025 Medusa Slockbower
+//
+// This program 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.
+//
+// This program 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 this program. If not, see .
+// =====================================================================================================================
+
+#ifndef FENNEC_LANG_DETAIL_TYPE_TRANSFORMS_H
+#define FENNEC_LANG_DETAIL_TYPE_TRANSFORMS_H
+
+#include
+
+namespace fennec
+{
+
+namespace detail
+{
+
+template
+struct __add_lvalue_reference {
+ using type = _Tp;
+};
+
+template
+struct __add_lvalue_reference<_Tp, void_t<_Tp&>> {
+ using type = _Tp&;
+};
+
+
+template
+struct __add_rvalue_reference {
+ using type = _Tp;
+};
+
+template
+struct __add_rvalue_reference<_Tp, void_t<_Tp&&>> {
+ using type = _Tp&&;
+};
+
+}
+
+}
+
+#endif // FENNEC_LANG_DETAIL_TYPE_TRANSFORMS_H
diff --git a/include/fennec/lang/hashing.h b/include/fennec/lang/hashing.h
new file mode 100644
index 0000000..75050bf
--- /dev/null
+++ b/include/fennec/lang/hashing.h
@@ -0,0 +1,89 @@
+// =====================================================================================================================
+// fennec, a free and open source game engine
+// Copyright © 2025 Medusa Slockbower
+//
+// This program 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.
+//
+// This program 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 this program. If not, see .
+// =====================================================================================================================
+
+#ifndef FENNEC_LANG_HASHING_H
+#define FENNEC_LANG_HASHING_H
+
+#include
+#include
+
+namespace fennec
+{
+
+///
+/// \brief Struct for hashing types, there is no default hashing function
+/// \tparam Key The type to hash
+template struct hash;
+
+// Murmur3 Hash for 64-bit ints
+template<>
+struct hash {
+ using type_t = uint64_t;
+ constexpr size_t operator()(uint64_t x) const {
+ // Murmur3
+ x ^= x >> 33U;
+ x *= 0xff51afd7ed558ccd;
+ x ^= x >> 33U;
+ x *= 0xc4ceb9fe1a85ec53;
+ x ^= x >> 33U;
+ return x;
+ }
+};
+
+// Wrapper for casting ints
+template
+ requires is_integral_v
+struct hash : hash {
+ using type_t = IntT;
+};
+
+// Wrapper for pointers
+template
+ requires is_pointer_v
+struct hash : hash {
+};
+
+// Float
+template<>
+struct hash : hash {
+ constexpr size_t operator()(float x) const {
+ return hash::operator()(bit_cast(x));
+ }
+};
+
+template<>
+struct hash : hash {
+ constexpr size_t operator()(double x) const {
+ return hash::operator()(bit_cast(x));
+ }
+};
+
+
+///
+/// \brief Pairs two hashes
+/// \param x first hash
+/// \param y second hash
+/// \returns a pairing of the two hashes
+constexpr size_t pair_hash(size_t x, size_t y) {
+ // Szudzik Pairing
+ return (x >= y ? (x * x) + x + y : (y * y) + x);
+}
+
+}
+
+#endif // FENNEC_LANG_HASHING_H
diff --git a/include/fennec/lang/intrinsics.h b/include/fennec/lang/intrinsics.h
index 10c04e7..b71bfec 100644
--- a/include/fennec/lang/intrinsics.h
+++ b/include/fennec/lang/intrinsics.h
@@ -142,14 +142,44 @@
# define FENNEC_HAS_BUILTIN_IS_CLASS
#endif
+// CONSTRUCTORS ========================================================================================================
+
// Difficult and Inconsistent without intrinsics
#if __has_builtin(__is_constructible)
# define FENNEC_HAS_BUILTIN_IS_CONSTRUCTIBLE 1
-# define FENNEC_BUILTIN_IS_CONSTRUCTIBLE(type, ...) __is_constructible(type, __VA_ARGS__)
+# define FENNEC_BUILTIN_IS_CONSTRUCTIBLE(type, ...) __is_constructible(type __VA_OPT__(,) __VA_ARGS__)
#else
# define FENNEC_HAS_BUILTIN_IS_CONSTRUCTIBLE 0
#endif
+// Difficult and Inconsistent without intrinsics
+#if __has_builtin(__is_trivially_constructible)
+# define FENNEC_HAS_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE 1
+# define FENNEC_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE(type) __is_trivially_constructible(type)
+#else
+# define FENNEC_HAS_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE 0
+#endif
+
+// Difficult and Inconsistent without intrinsics
+#if __has_builtin(__has_trivial_destructor)
+# define FENNEC_HAS_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE 1
+# define FENNEC_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE(type) __has_trivial_destructor(type)
+#else
+# define FENNEC_HAS_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE 0
+#endif
+
+
+// ASSIGNMENTS =========================================================================================================
+
+// Difficult and Inconsistent without intrinsics
+#if __has_builtin(__is_assignable)
+# define FENNEC_HAS_BUILTIN_IS_ASSIGNABLE 1
+# define FENNEC_BUILTIN_IS_ASSIGNABLE(a, b) __is_assignable(a, b)
+#else
+# define FENNEC_HAS_BUILTIN_IS_ASSIGNABLE 0
+#endif
+
+
// Type Traits
// can_convert is also very difficult to implement without intrinsics
#if __has_builtin(__is_convertible)
diff --git a/include/fennec/lang/type_identity.h b/include/fennec/lang/type_identity.h
new file mode 100644
index 0000000..cf0e419
--- /dev/null
+++ b/include/fennec/lang/type_identity.h
@@ -0,0 +1,57 @@
+// =====================================================================================================================
+// fennec, a free and open source game engine
+// Copyright © 2025 Medusa Slockbower
+//
+// This program 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.
+//
+// This program 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 this program. If not, see .
+// =====================================================================================================================
+
+#ifndef FENNEC_LANG_TYPE_IDENTITY_H
+#define FENNEC_LANG_TYPE_IDENTITY_H
+
+///
+/// \page fennec_lang_type_identity Type Identity
+///
+/// \brief Part of the fennec metaprogramming library. This header defines structures for copying types with different traits
+/// or rather, transform them, at compile time.
+///
+/// \code #include \endcode
+///
+///
+///
+/// | Syntax
+/// | Description
+/// |
|---|
+/// \ref fennec::type_identity "type_identity::type"
+///
+/// \copydetails fennec::type_identity
+/// | |
+///
+
+namespace fennec
+{
+
+///
+/// \brief Base Class for Type Transformations
+///
+/// \details resembles a transformation from one type to T, the result is stored in the member type_transform::type
+/// \tparam T Resultant Type
+template struct type_identity {
+
+ /// \brief the type to transform into
+ using type = T;
+};
+
+}
+
+#endif // FENNEC_LANG_TYPE_IDENTITY_H
diff --git a/include/fennec/lang/type_traits.h b/include/fennec/lang/type_traits.h
index b6450e8..2c63dfd 100644
--- a/include/fennec/lang/type_traits.h
+++ b/include/fennec/lang/type_traits.h
@@ -272,6 +272,22 @@ template struct is_floating_point
template constexpr bool_t is_floating_point_v = is_floating_point {};
+// Pointer Types =======================================================================================================
+
+///
+/// \brief check if \p T is of a floating point type
+///
+/// \details Checks if type `T` is a floating point type and store it in `is_same::value`.
+/// \tparam T type to check
+template struct is_pointer
+ : detail::__is_pointer>{};
+
+///
+/// \brief shorthand for ```is_floating_point::value```
+/// \tparam T type to check
+template constexpr bool_t is_pointer_v = is_pointer {};
+
+
// Arithmetic Types ====================================================================================================
@@ -339,7 +355,7 @@ template struct is_convertible
template constexpr bool_t is_convertible_v = is_convertible{};
-// fennec::is_constructible ===============================================================================================
+// fennec::is_constructible ============================================================================================
///
/// \brief Check if `ClassT` can be constructed with `ArgsT,` i.e. `ClassT(ArgsT...)`.
@@ -354,7 +370,106 @@ template struct is_constructible
template constexpr bool_t is_constructible_v = is_constructible{};
-// fennec::
+
+///
+/// \brief Check if `ClassT` is default constructible
+/// \tparam ClassT The class type to test
+template struct is_default_constructible
+ : bool_constant {};
+
+///
+/// \brief Shorthand for `is_default_constructible::value`
+template constexpr bool_t is_default_constructible_v = is_default_constructible{};
+
+
+
+///
+/// \brief Check if `ClassT` is copy constructible
+/// \tparam ClassT The class type to test
+template struct is_copy_constructible
+ : bool_constant)> {};
+
+///
+/// \brief Shorthand for `is_copy_constructible::value`
+template constexpr bool_t is_copy_constructible_v = is_copy_constructible{};
+
+
+
+///
+/// \brief Check if `ClassT` is copy constructible
+/// \tparam ClassT The class type to test
+template struct is_move_constructible
+ : bool_constant)> {};
+
+///
+/// \brief Shorthand for `is_copy_constructible::value`
+template constexpr bool_t is_move_constructible_v = is_move_constructible{};
+
+
+
+///
+/// \brief Check if `ClassT` is trivially constructible
+/// \tparam ClassT The class type to test
+template struct is_trivially_constructible
+ : bool_constant {};
+
+///
+/// \brief Shorthand for `is_trivially_constructible::value`
+template constexpr bool_t is_trivially_constructible_v = is_trivially_constructible{};
+
+
+// fennec::is_trivially_destructible ===================================================================================
+
+///
+/// \brief Check if `ClassT` is trivially destructible
+/// \tparam ClassT The class type to test
+template struct is_trivially_destructible
+ : bool_constant {};
+
+///
+/// \brief Shorthand for `is_trivially_destructible::value`
+template constexpr bool_t is_trivially_destructible_v = is_trivially_destructible{};
+
+
+// fennec::is_assignable ===============================================================================================
+
+///
+/// \brief Check if `ClassT` can be constructed with `ArgsT,` i.e. `ClassT(ArgsT...)`.
+/// This may be read as "is `ClassT` constructible with `ArgsT`"
+/// \tparam ClassAT The class type to test
+/// \tparam ClassBT The arguments for the specific constructor
+template struct is_assignable
+ : bool_constant {};
+
+///
+/// \brief Shorthand for `is_constructible::value`
+template constexpr bool_t is_assignable_v = is_assignable{};
+
+
+// fennec::is_copy_assignable ==========================================================================================
+
+///
+/// \brief Check if `ClassT` is copy assignable
+/// \tparam ClassT The class type to test
+template struct is_copy_assignable
+ : bool_constant, add_lvalue_reference_t)> {};
+
+///
+/// \brief Shorthand for `is_copy_assignable |