- Setup Basic Implementation for String Library

This commit is contained in:
2025-07-06 19:29:28 -04:00
parent a33bf5206f
commit 012052641d
17 changed files with 646 additions and 41 deletions

View File

@@ -35,6 +35,9 @@ template<> struct __is_void<void> : true_type {};
template<typename> struct __is_bool : false_type {};
template<> struct __is_bool<bool_t> : true_type {};
template<typename> struct __is_null_pointer : false_type {};
template<> struct __is_null_pointer<nullptr_t> : true_type {};
// Provides definitions for all builtin int types
template<typename> struct __is_integral : false_type {};
template<> struct __is_integral<bool_t> : true_type {};

View File

@@ -126,6 +126,22 @@
# define FENNEC_HAS_BUILTIN_IS_ABSTRACT 0
#endif
// Inconsistent without intrinsics
#if __has_builtin(__is_array)
# define FENNEC_HAS_BUILTIN_IS_ARRAY 1
# define FENNEC_BUILTIN_IS_ARRAY(arg) __is_array(arg)
#else
# define FENNEC_HAS_BUILTIN_IS_ARRAY
#endif
// Inconsistent without intrinsics
#if __has_builtin(__is_class)
# define FENNEC_HAS_BUILTIN_IS_CLASS 1
# define FENNEC_BUILTIN_IS_CLASS(arg) __is_class(arg)
#else
# define FENNEC_HAS_BUILTIN_IS_CLASS
#endif
// Difficult and Inconsistent without intrinsics
#if __has_builtin(__is_constructible)
# define FENNEC_HAS_BUILTIN_IS_CONSTRUCTIBLE 1
@@ -159,6 +175,22 @@
#endif
#endif
// Inconsistent without intrinsics.
#if __has_builtin(__is_enum)
# define FENNEC_HAS_BUILTIN_IS_ENUM 1
# define FENNEC_BUILTIN_IS_ENUM(arg) __is_enum(arg)
#else
# define FENNEC_HAS_BUILTIN_IS_ENUM 0
#endif
// Inconsistent without intrinsics
#if __has_builtin(__is_final)
# define FENNEC_HAS_BUILTIN_IS_FINAL 1
# define FENNEC_BUILTIN_IS_FINAL(arg) __is_final(arg)
#else
# define FENNEC_HAS_BUILTIN_IS_FINAL 0
#endif
// Inconsistent without intrinsics
#if __has_builtin(__is_polymorphic)
# define FENNEC_HAS_BUILTIN_IS_POLYMORPHIC 1

View File

@@ -148,6 +148,74 @@ template<typename T> constexpr bool_t is_bool_v
// fennec::is_null_pointer =============================================================================================
///
/// \brief check if \p T is of type nullptr_t
///
/// \details Stores a boolean value in `is_null_pointer::value`, representing whether the provided type is of base type nullptr_t.
/// \tparam T type to check
template<typename T> struct is_null_pointer
: detail::__is_null_pointer<remove_cvr_t<T>>{};
///
/// \brief shorthand for ```is_null_pointer<T>::value```
/// \tparam T type to check
template<typename T> constexpr bool_t is_null_pointer_v
= is_null_pointer<T>::value;
// fennec::is_array ====================================================================================================
#if FENNEC_HAS_BUILTIN_IS_ARRAY
///
/// \brief check if \p T is of an array type
/// \tparam T type to check
template<typename T> struct is_array
: bool_constant<FENNEC_BUILTIN_IS_ARRAY(T)> {};
#else
///
/// \brief check if \p T is of an array type
/// \tparam T type to check
template<typename T> struct is_array
: false_type {};
// overload for a sized array type
template<typename T, size_t N> struct is_array<T[N]>
: true_type {};
// overload for a generic array type
template<typename T> struct is_array<T[]>
: true_type {};
#endif
///
/// \brief shorthand for ```is_array<T>::value```
/// \tparam T type to check
template<typename T> constexpr bool_t is_array_v
= is_array<T>::value;
// fennec::is_class ====================================================================================================
///
/// \brief check if \p T is a class
/// \tparam T type to check
template<typename T> struct is_class
: bool_constant<FENNEC_BUILTIN_IS_CLASS(T)> {};
///
/// \brief check if \p T is a class
/// \tparam T type to check
template<typename T> constexpr size_t is_class_v
= is_class<T>::value;
// Integral Types ======================================================================================================
///