- Added More Documentation

This commit is contained in:
2025-06-18 19:23:49 -04:00
parent 6d3c276bfe
commit 909be55ed3
20 changed files with 255 additions and 61 deletions

View File

@@ -44,11 +44,11 @@ add_library(fennec STATIC
include/fennec/lang/type_transforms.h
include/fennec/lang/types.h
include/fennec/lang/utility.h
include/fennec/lang/variadics.h
include/fennec/lang/type_sequences.h
include/fennec/lang/detail/__numeric_transforms.h
include/fennec/lang/detail/__type_traits.h
include/fennec/lang/detail/__variadics.h
include/fennec/lang/detail/__type_sequences.h
# MEMORY ===============================================================================================================

View File

@@ -18,7 +18,7 @@
///
/// \file bits.h
/// \brief bit-wise operations
/// \brief \ref fennec_lang_bit_manipulation
///
///
/// \details

View File

@@ -18,7 +18,7 @@
///
/// \file conditional_types.h
/// \brief metaprogramming to conditionally set a type
/// \brief \ref fennec_lang_conditional_types
///
///
/// \details

View File

@@ -18,7 +18,7 @@
///
/// \file constants.h
/// \brief metaprogramming constants
/// \brief \ref fennec_lang_constants
///
///
/// \details

View File

@@ -16,8 +16,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
#ifndef FENNEC_LANG_DETAIL_VARIADICS_H
#define FENNEC_LANG_DETAIL_VARIADICS_H
#ifndef FENNEC_LANG_DETAIL_TYPE_SEQUENCES_H
#define FENNEC_LANG_DETAIL_TYPE_SEQUENCES_H
#include <fennec/lang/type_transforms.h>
@@ -33,4 +33,4 @@ template<typename FirstT, typename... RestT> struct __first_element : type_trans
}
#endif // FENNEC_LANG_DETAIL_VARIADICS_H
#endif // FENNEC_LANG_DETAIL_TYPE_SEQUENCES_H

View File

@@ -18,8 +18,7 @@
///
/// \file intrinsics.h
/// \brief This header contains definitions for compiler intrinsics necessary for implementing functions of the
/// C++ stdlib.
/// \brief \ref fennec_lang_intrinsics
///
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
@@ -34,6 +33,8 @@
/// \brief This header contains definitions for compiler intrinsics necessary for implementing functions of the
/// C++ stdlib.
///
/// \code{.cpp}#include <fennec/lang/intrinsics.h>\endcode
///
///
/// <table width="100%" class="fieldtable" id="table_fennec_lang_intrinsics">
/// <tr><th style="vertical-align: top">Syntax

View File

@@ -18,7 +18,7 @@
///
/// \file lang.h
/// \brief fennec C++ language library
/// \brief fennec C++ Language Library
///
///
/// \details
@@ -41,6 +41,7 @@
/// - \subpage fennec_lang_limits
/// - \subpage fennec_lang_metaprogramming
/// - \subpage fennec_lang_types
/// - \subpage fennec_lang_utility
///
///
@@ -55,7 +56,9 @@
/// - \subpage fennec_lang_conditional_types
/// - \subpage fennec_lang_numeric_transforms
/// - \subpage fennec_lang_sequences
/// - \subpage fennec_lang_type_sequences
/// - \subpage fennec_lang_type_traits
/// - \subpage fennec_lang_type_transforms
///
///

View File

@@ -18,7 +18,7 @@
///
/// \file limits.h
/// \brief contains the limits of builtin data types to C++
/// \brief \ref fennec_lang_limits
///
///
/// \details

View File

@@ -18,7 +18,7 @@
///
/// \file numeric_transforms.h
/// \brief modify numeric types at compile time
/// \brief \ref fennec_lang_numeric_transforms
///
///
/// \details

View File

@@ -18,7 +18,7 @@
///
/// \file sequences.h
/// \brief metaprogramming sequences
/// \brief \ref fennec_lang_sequences
///
///
/// \details

View File

@@ -17,8 +17,8 @@
// =====================================================================================================================
///
/// \file variadics.h
/// \brief basic types of the c++ language
/// \file type_sequences.h
/// \brief \ref fennec_lang_type_sequences
///
///
/// \details
@@ -28,10 +28,35 @@
///
///
#ifndef FENNEC_LANG_VARIADICS_H
#define FENNEC_LANG_VARIADICS_H
#ifndef FENNEC_LANG_TYPE_SEQUENCES_H
#define FENNEC_LANG_TYPE_SEQUENCES_H
#include <fennec/lang/detail/__variadics.h>
///
/// \page fennec_lang_type_sequences Type Sequences
///
/// \brief This header is part of the metaprogramming library. It defines structures for sequences of types, used during compile time.
///
/// \code #include <fennec/lang/type_sequences.h> \endcode
///
/// <table width="100%" class="fieldtable" id="table_fennec_lang_constants">
/// <tr><th style="vertical-align: top">Syntax
/// <th style="vertical-align: top">Description
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::first_element "typename first_element<ValueT, Values...>::type"<br>
/// \ref fennec::first_element_t "first_element_t<ValueT, Values...>"
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::first_element
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::replace_first_element "typename replace_first_element<ClassT, SubT, OriginT, RestT...>::type"<br>
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::replace_first_element
///
/// </table>
///
#include <fennec/lang/detail/__type_sequences.h>
namespace fennec
{

View File

@@ -18,7 +18,7 @@
///
/// \file type_traits.h
/// \brief get info about types at compile-time
/// \brief \ref fennec_lang_type_traits
///
///
/// \details
@@ -92,6 +92,18 @@
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::is_same
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::can_convert "can_convert<TypeT0, TypeT1>::value"<br>
/// \ref fennec::can_convert_v "can_convert_v<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::can_convert
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::is_constructible "is_constructible<ClassT, ArgsT...>::value"<br>
/// \ref fennec::is_constructible_v "is_constructible_v<ClassT, ArgsT...>"
/// <td width="50%" style="vertical-align: top">
/// \copydoc fennec::is_constructible
///
/// </table>
///
@@ -157,7 +169,7 @@ template<typename T> constexpr bool_t is_integral_v
///
/// \brief check if \p T is of a signed integral
///
/// \details
/// \details Checks if type `T` is a signed type i.e. `T(-1) < T(0)` and stores it in `is_same::value`.
/// \tparam T type to check
template<typename T> struct is_signed
: detail::__is_signed<remove_cvr_t<T>> {};
@@ -172,7 +184,7 @@ template<typename T> constexpr bool_t is_signed_v
///
/// \brief check if \p T is of an unsigned integral
///
/// \details
/// \details Checks if type `T` is an unsigned type i.e. `T(-1) > T(0)` and stores it in `is_same::value`.
/// \tparam T type to check
template<typename T> struct is_unsigned
: detail::__is_unsigned<remove_cvr_t<T>> {};
@@ -190,7 +202,7 @@ template<typename T> constexpr bool_t is_unsigned_v
///
/// \brief check if \p T is of a floating point type
///
/// \details
/// \details Checks if type `T` is a floating point type and store it in `is_same::value`.
/// \tparam T type to check
template<typename T> struct is_floating_point
: detail::__is_floating_point<remove_cvr_t<T>>{};
@@ -208,7 +220,7 @@ template<typename T> constexpr bool_t is_floating_point_v
///
/// \brief check if \p T is an arithmetic type
///
/// \details
/// \details Checks if type `T` is a built-in type with arithmetic operators and store it in `is_same::value`.
/// \tparam T type to check
template<typename T> struct is_arithmetic
: bool_constant<is_integral_v<T> or is_floating_point_v<T>>{};
@@ -224,8 +236,9 @@ template<typename T> constexpr bool_t is_arithmetic_v
///
/// \brief check if the two types are identical
///
/// \details
/// \tparam T type to check
/// \details Checks if `T0` and `T1` are identical and store it in `is_same::value`
/// \tparam T0 first type to check
/// \tparam T1 second type to check
template<typename T0, typename T1> struct is_same
: false_type {};
@@ -243,17 +256,19 @@ template<typename T0, typename T1> constexpr bool_t is_same_v
///
/// \brief check if type `T0` can be converted `T1`
/// \tparam T0 First type
/// \tparam T1 Second type
template<typename T0, typename T1> struct can_convert
: bool_constant<FENNEC_BUILTIN_IS_CONVERTIBLE(T0, T1)> {};
///
/// \details Checks if `TypeT0`
/// \tparam FromT First type
/// \tparam ToT Second type
template<typename FromT, typename ToT> struct is_convertible
: bool_constant<FENNEC_BUILTIN_IS_CONVERTIBLE(FromT, ToT)> {};
///
/// \brief shorthand
/// \param T0 First type
/// \param T1 Second type
template<typename T0, typename T1> using can_convert_v
= typename can_convert<T0, T1>::type;
/// \brief shorthand for `can_convert<TypeT0, TypeT1>::value`
/// \param FromT First type
/// \param ToT Second type
template<typename FromT, typename ToT> using is_convertible_v
= typename is_convertible<FromT, ToT>::type;
// fennec::is_constructible ===============================================================================================
@@ -266,6 +281,8 @@ template<typename T0, typename T1> using can_convert_v
template<typename ClassT, typename...ArgsT> struct is_constructible
: bool_constant<FENNEC_BUILTIN_IS_CONSTRUCTIBLE(ClassT, ArgsT...)> {};
///
/// \brief Shorthand for `is_constructible<ClassT, ArgsT...>::value`
template<typename ClassT, typename...ArgsT> constexpr bool_t is_constructible_v
= is_constructible<ClassT, ArgsT...>{};

View File

@@ -18,7 +18,7 @@
///
/// \file type_transforms.h
/// \brief modify types at compile time
/// \brief \ref fennec_lang_type_transforms
///
///
/// \details
@@ -31,6 +31,100 @@
#ifndef FENNEC_LANG_TYPE_TRANSFORMS_H
#define FENNEC_LANG_TYPE_TRANSFORMS_H
///
/// \page fennec_lang_type_transforms Type Transforms
///
/// \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 <fennec/lang/type_transforms.h> \endcode
///
///
/// <table width="100%" class="fieldtable" id="table_fennec_lang_constants">
/// <tr><th style="vertical-align: top">Syntax
/// <th style="vertical-align: top">Description
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::type_transform "type_transform<TypeT>::type"<br>
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::type_transform
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::add_pointer "add_pointer<TypeT>::type"<br>
/// \ref fennec::add_pointer_t "add_pointer_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::add_pointer
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::remove_pointer "remove_pointer<TypeT>::type"<br>
/// \ref fennec::remove_pointer_t "remove_pointer_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::remove_pointer
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::add_reference "add_reference<TypeT>::type"<br>
/// \ref fennec::add_reference_t "add_reference_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::add_reference
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::remove_reference "remove_reference<TypeT>::type"<br>
/// \ref fennec::remove_reference_t "remove_reference_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::remove_reference
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::add_const "add_const<TypeT>::type"<br>
/// \ref fennec::add_const_t "add_const_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::add_const
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::remove_const "remove_const<TypeT>::type"<br>
/// \ref fennec::remove_const_t "remove_const_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::remove_const
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::add_volatile "add_volatile<TypeT>::type"<br>
/// \ref fennec::add_volatile_t "add_volatile_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::add_volatile
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::remove_volatile "remove_volatile<TypeT>::type"<br>
/// \ref fennec::remove_volatile_t "remove_volatile_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::remove_volatile
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::add_cv "add_cv<TypeT>::type"<br>
/// \ref fennec::add_cv_t "add_cv_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::add_cv
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::remove_cv "remove_cv<TypeT>::type"<br>
/// \ref fennec::remove_cv_t "remove_cv_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::remove_cv
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::add_cvr "add_cvr<TypeT>::type"<br>
/// \ref fennec::add_cvr_t "add_cvr_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::add_cvr
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::remove_cvr "remove_cvr<TypeT>::type"<br>
/// \ref fennec::remove_cvr_t "remove_cvr_t<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::remove_cvr
///
/// </table>
///
namespace fennec
{
@@ -40,7 +134,7 @@ namespace fennec
/// \struct fennec::type_transform
/// \brief Base Class for Type Transformations
///
/// \details resembles a transformation from one type to T, the result is stored in the typedef type_transform::type
/// \details resembles a transformation from one type to T, the result is stored in the member type_transform::type
/// \tparam T Resultant Type
template<typename T> struct type_transform {

View File

@@ -18,7 +18,7 @@
///
/// \file types.h
/// \brief basic types of the c++ language
/// \brief \ref fennec_lang_types
///
///
/// \details
@@ -34,10 +34,10 @@
///
/// \page fennec_lang_types Types
///
/// \brief This header contains definitions for built-in types.
/// \brief This header contains definitions for the built-in types of the C++ language.
///
/// <table width="100%" class="fieldtable" id="table_fennec_lang_types">
/// <tr><th style="vertical-align: top">Member
/// <tr><th style="vertical-align: top">Type
/// <th style="vertical-align: top">Description
///
/// <tr><th colspan=2 style="text-align: center;">Basic Types

View File

@@ -18,7 +18,7 @@
///
/// \file utility.h
/// \brief common utility functions related to the c++ language
/// \brief \ref fennec_lang_utility
///
///
/// \details
@@ -31,46 +31,67 @@
#ifndef FENNEC_LANG_UTILITY_H
#define FENNEC_LANG_UTILITY_H
///
/// \page fennec_lang_utility Utility
///
/// \brief This header contains common utility functions related to the C++ language.
///
/// \code #include <fennec/lang/utility.h> \endcode
///
/// <table width="100%" class="fieldtable" id="table_fennec_lang_constants">
/// <tr><th style="vertical-align: top">Syntax
/// <th style="vertical-align: top">Description
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::forward "T&& forward(x)"<br>
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::forward
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::move "T&& move(x)"<br>
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::move
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::copy "const T& copy(x)"<br>
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::copy
///
/// </table>
///
#include <fennec/lang/type_transforms.h>
namespace fennec
{
///
/// \brief forwards reference types to extend their lifetime
///
/// \details
/// \details forwards reference types to extend their lifetime
/// \tparam T base type of the object
/// \param x reference to the object
/// \returns
template<typename T> constexpr T&& forward(remove_reference_t<T>& x) noexcept { return x; }
///
///
/// \brief forwards reference types to extend their lifetime
///
/// \details
/// \tparam T base type of the object
/// \param x reference to the object
/// \returns
// specialization for T&&
template<typename T> constexpr T&& forward(remove_reference_t<T>&& x) noexcept { return x; }
///
///
/// \brief produces an x-value type to indicate \p x may be "moved"
///
/// \details
/// \details produces an x-value type to indicate \p x may be "moved"
/// \tparam T base type of the object
/// \param x object to be moved
/// \returns `static_cast<remove_reference_t<T>&&>(x)`
template<typename T> constexpr remove_reference_t<T>&& move(T&& x) noexcept { return static_cast<remove_reference_t<T>&&>(x); }
///
///
/// \brief produces an r-value type to indicate \p x may be "copied"
///
/// \details
/// \details produces an r-value type to indicate \p x may be "copied"
/// \tparam T base type of the object
/// \param x object to be copied
/// \returns const r-value

View File

@@ -18,7 +18,7 @@
///
/// \file math.h
/// \brief main math header which includes the main modules
/// \brief fennec Math Library
///
///
/// \details This header includes the following modules of \ref fennec_math :

View File

@@ -18,7 +18,7 @@
///
/// \file swizzle.h
/// \brief part of the \ref fennec_math_vector,
/// \brief \ref fennec_math_swizzle
///
///
/// \details

View File

@@ -18,7 +18,7 @@
///
/// \file vector_traits.h
/// \brief part of the \ref fennec_math_vector
/// \brief
///
///
/// \details this header implements functions to test vector types at compile time
@@ -31,6 +31,39 @@
#ifndef FENNEC_MATH_VECTOR_TRAITS_H
#define FENNEC_MATH_VECTOR_TRAITS_H
///
/// \page fennec_math_vector_traits Vector Traits
///
/// \brief Part of the fennec math library. This header defines structures for metaprogramming with vectors.
///
/// \code #include <fennec/math/vector_traits.h> \endcode
///
///
/// <table width="100%" class="fieldtable" id="table_fennec_lang_constants">
/// <tr><th style="vertical-align: top">Syntax
/// <th style="vertical-align: top">Description
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::is_vector "is_vector<TypeT>::value"<br>
/// \ref fennec::is_vector_v "is_vector_v<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::is_vector
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::component_count "component_count<TypeT>::value"<br>
/// \ref fennec::component_count_v "component_count_v<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::component_count
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::total_component_count "total_component_count<TypeT>::value"<br>
/// \ref fennec::total_component_count_v "total_component_count_v<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::total_component_count
///
/// </table>
///
#include <fennec/math/detail/__vector_traits.h>
namespace fennec

View File

@@ -22,7 +22,7 @@
#include <fennec/lang/conditional_types.h>
#include <fennec/lang/types.h>
#include <fennec/lang/type_traits.h>
#include <fennec/lang/variadics.h>
#include <fennec/lang/type_sequences.h>
namespace fennec
{

View File

@@ -34,7 +34,7 @@ struct default_delete
///
/// \brief Conversion Constructor
/// \tparam ConvT of other deleter
template<class ConvT> requires requires { can_convert<ConvT*, TypeT*>{}.value == true; }
template<class ConvT> requires requires { is_convertible<ConvT*, TypeT*>{}.value == true; }
constexpr default_delete(const default_delete<ConvT>&) noexcept {}
///
@@ -58,13 +58,13 @@ struct default_delete<TypeT[]>
///
/// \brief Conversion Constructor
/// \tparam ConvT of other deleter
template<class ConvT> requires requires { can_convert<ConvT(*)[], TypeT(*)[]>{}.value == true; }
template<class ConvT> requires requires { is_convertible<ConvT(*)[], TypeT(*)[]>{}.value == true; }
constexpr default_delete(const default_delete<ConvT(*)[]>&) noexcept {}
///
/// \brief Function Call Operator, calls `delete` on `ptr`
/// \param ptr Memory resource to delete
template<class ArrT> requires requires { can_convert<ArrT(*)[], TypeT(*)[]>{}.value == true; }
template<class ArrT> requires requires { is_convertible<ArrT(*)[], TypeT(*)[]>{}.value == true; }
constexpr void operator()(TypeT* ptr) const noexcept
{
static_assert(not is_void_v<TypeT>, "cannot delete a pointer to an incomplete type");