- Added More Documentation

This commit is contained in:
Medusa Slockbower 2025-06-18 11:57:57 -04:00
parent 9d35daa494
commit 6d3c276bfe
4 changed files with 143 additions and 76 deletions

View File

@ -141,6 +141,8 @@ if(DOXYGEN_FOUND)
COMMENT "Generating Doxygen Documentation" COMMENT "Generating Doxygen Documentation"
VERBATIM) VERBATIM)
add_dependencies(fennecdocs fennecdocs-clean)
# Target for cleaning docs # Target for cleaning docs
add_custom_target(fennecdocs-clean ALL add_custom_target(fennecdocs-clean ALL
COMMAND rm -r "${PROJECT_SOURCE_DIR}/docs/" COMMAND rm -r "${PROJECT_SOURCE_DIR}/docs/"

View File

@ -54,6 +54,8 @@
/// - \subpage fennec_lang_constants /// - \subpage fennec_lang_constants
/// - \subpage fennec_lang_conditional_types /// - \subpage fennec_lang_conditional_types
/// - \subpage fennec_lang_numeric_transforms /// - \subpage fennec_lang_numeric_transforms
/// - \subpage fennec_lang_sequences
/// - \subpage fennec_lang_type_traits
/// ///
/// ///

View File

@ -31,6 +31,45 @@
#ifndef FENNEC_LANG_SEQUENCES_H #ifndef FENNEC_LANG_SEQUENCES_H
#define FENNEC_LANG_SEQUENCES_H #define FENNEC_LANG_SEQUENCES_H
///
/// \page fennec_lang_sequences Sequences
///
/// \brief This header is part of the metaprogramming library. It defines structures for sequences of values, used during compile time.
///
/// \code #include <fennec/lang/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::sequence "sequence<ValueT, Values...>"<br>
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::sequence
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::integer_sequence "integer_sequence<IntT, Values...>"<br>
/// \ref fennec::make_integer_sequence "typename make_integer_sequence<IntT, N>::type"<br>
/// \ref fennec::make_integer_sequence_t "make_integer_sequence_t<IntT, N>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::integer_sequence
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::index_sequence "index_sequence<Indices...>"<br>
/// \ref fennec::make_index_sequence "typename make_index_sequence<N>::type"<br>
/// \ref fennec::make_index_sequence_t "make_index_sequence_t<N>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::index_sequence
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::concat_sequence "typename concat_sequence<SequenceT0, SequenceT1>::type"<br>
/// \ref fennec::concat_sequence_t "concat_sequence_t<SequenceT0, SequenceT1>"<br>
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::concat_sequence
///
/// </table>
///
#include <fennec/lang/type_traits.h> #include <fennec/lang/type_traits.h>
namespace fennec namespace fennec
@ -38,56 +77,54 @@ namespace fennec
// fennec::sequence ==================================================================================================== // fennec::sequence ====================================================================================================
///
/// ///
/// \brief metaprogramming sequence /// \brief metaprogramming sequence
/// ///
/// \details /// \details Stores a sequence of values of type `ValueT` as a template pack.
/// You can access the parameter pack in another template function, i.e.
/// \code{cpp}
/// template<typename TypeT, TypeT...Values>
/// constexpr TypeT summation(sequence<TypeT, Values...>)
/// {
/// return (Values + ...);
/// }
/// \endcode
/// \tparam ValueT type of the values /// \tparam ValueT type of the values
/// \tparam ValuesV sequence values /// \tparam Values sequence values
/// template<typename ValueT, ValueT...Values> struct sequence
template<typename ValueT, ValueT...ValuesV> struct sequence
{ {
///
/// \brief type of the sequence /// \brief type of the sequence
using value_type = ValueT; using value_type = ValueT;
///
/// \brief self-referential type /// \brief self-referential type
using type = sequence; using type = sequence;
///
/// ///
/// \brief returns the number of elements /// \brief returns the number of elements
/// ///
/// \return number of elements in the array /// \return number of elements in the array
inline static constexpr size_t size() noexcept { return sizeof...(ValuesV); } inline static constexpr size_t size() noexcept { return sizeof...(Values); }
}; };
// fennec::integer_sequence ============================================================================================ // fennec::integer_sequence ============================================================================================
///
/// ///
/// \brief metaprogramming integral sequence /// \brief metaprogramming integral sequence
/// ///
/// \details /// \details A `fennec::sequence` specialized integer types.
/// \tparam T type of the values, must satisfy ```fennec::is_integral<T>``` /// \tparam IntT type of the values, must satisfy ```fennec::is_integral<T>```
/// \tparam Values sequence values /// \tparam Values sequence values
/// template<typename IntT, IntT...Values> requires(is_integral_v<IntT>)
template<typename T, T...Values> requires(is_integral_v<T>) struct integer_sequence : sequence<IntT, Values...>
struct integer_sequence : sequence<T, Values...>
{ {
///
/// \brief type of the sequence /// \brief type of the sequence
using value_type = T; using value_type = IntT;
///
/// \brief self-referential type /// \brief self-referential type
using type = integer_sequence; using type = integer_sequence;
///
/// ///
/// \brief returns the number of elements /// \brief returns the number of elements
/// ///
@ -96,42 +133,35 @@ struct integer_sequence : sequence<T, Values...>
}; };
///
/// ///
/// \brief generate a fennec::integer_sequence \f$\left[\,0\,\ldots\,N\,\right)\f$ /// \brief generate a fennec::integer_sequence \f$\left[\,0\,\ldots\,N\,\right)\f$
/// ///
/// \details /// \details
/// \tparam T type of the values, must satisfy ```fennec::is_integral<T>``` /// \tparam IntT type of the values, must satisfy ```fennec::is_integral<T>```
/// \tparam N size of the sequence to generate /// \tparam N size of the sequence to generate
/// template<typename IntT, size_t N> struct make_integer_sequence;
template<typename T, size_t N> struct make_integer_sequence;
/// ///
/// \brief shorthand for ```typename make_integer_sequence<T, N>::type``` /// \brief shorthand for ```typename make_integer_sequence<T, N>::type```
template<typename T, size_t N> using make_integer_sequence_t = typename make_integer_sequence<T, N>::type; template<typename IntT, size_t N> using make_integer_sequence_t = typename make_integer_sequence<IntT, N>::type;
// fennec::index_sequence ============================================================================================== // fennec::index_sequence ==============================================================================================
///
/// ///
/// \brief metaprogramming integral sequence /// \brief metaprogramming integral sequence
/// ///
/// \details /// \details A `fennec::integer_sequence` specialized for sequences of `size_t` indices.
/// \tparam Indices sequence values /// \tparam Indices sequence values
///
template<size_t...Indices> struct index_sequence : integer_sequence<size_t, Indices...> template<size_t...Indices> struct index_sequence : integer_sequence<size_t, Indices...>
{ {
///
/// \brief type of the sequence /// \brief type of the sequence
using value_type = size_t; using value_type = size_t;
///
/// \brief self-referential type /// \brief self-referential type
using type = index_sequence; using type = index_sequence;
///
/// ///
/// \brief returns the number of elements /// \brief returns the number of elements
/// ///
@ -140,14 +170,12 @@ template<size_t...Indices> struct index_sequence : integer_sequence<size_t, Indi
}; };
///
/// ///
/// \brief generate a fennec::index_sequence \f$\left[\,0\,\ldots\,N\,\right)\f$ /// \brief generate a fennec::index_sequence \f$\left[\,0\,\ldots\,N\,\right)\f$
/// ///
/// \details /// \details
/// \tparam T type of the values, must satisfy ```fennec::is_integral<T>``` /// \tparam T type of the values, must satisfy ```fennec::is_integral<T>```
/// \tparam N size of the sequence to generate /// \tparam N size of the sequence to generate
///
template<size_t N> struct make_index_sequence; template<size_t N> struct make_index_sequence;
/// ///
@ -158,11 +186,10 @@ template<size_t N> using make_index_sequence_t = typename make_index_sequence<N
// fennec::concat_sequence ============================================================================================= // fennec::concat_sequence =============================================================================================
///
/// ///
/// \brief concatenate two sequences /// \brief concatenate two sequences
/// ///
/// \details /// \details A tool for concatenating two `fennec::sequence` types.
/// \tparam SequenceT0 lhs /// \tparam SequenceT0 lhs
/// \tparam SequenceT1 rhs /// \tparam SequenceT1 rhs
template<typename SequenceT0, typename SequenceT1> struct concat_sequence; template<typename SequenceT0, typename SequenceT1> struct concat_sequence;
@ -172,29 +199,6 @@ template<typename SequenceT0, typename SequenceT1> struct concat_sequence;
template<typename SequenceT0, typename SequenceT1> using concat_sequence_t template<typename SequenceT0, typename SequenceT1> using concat_sequence_t
= typename concat_sequence<SequenceT0, SequenceT1>::type; = typename concat_sequence<SequenceT0, SequenceT1>::type;
///
///
/// \brief specialization to concatenate two integer sequences
///
/// \details
/// \tparam T integral type
/// \tparam SequenceT0 lhs
/// \tparam SequenceT1 rhs
template<typename T, T...SequenceV0, T...SequenceV1>
struct concat_sequence<integer_sequence<T, SequenceV0...>, integer_sequence<T, SequenceV1...>>
: integer_sequence<T, SequenceV0..., (sizeof...(SequenceV0) + SequenceV1)...>{};
///
///
/// \brief specialization to concatenate two index sequences
///
/// \details
/// \tparam SequenceT0 lhs
/// \tparam SequenceT1 rhs
template<size_t...SequenceV0, size_t...SequenceV1>
struct concat_sequence<index_sequence<SequenceV0...>, index_sequence<SequenceV1...>>
: index_sequence<SequenceV0..., (sizeof...(SequenceV0) + SequenceV1)...>{};
// Internal ============================================================================================================ // Internal ============================================================================================================
@ -219,6 +223,17 @@ template<> struct make_index_sequence<0> : index_sequence<> {};
template<> struct make_index_sequence<1> : index_sequence<0>{}; template<> struct make_index_sequence<1> : index_sequence<0>{};
// Specialization for integer sequences
template<typename T, T...SequenceV0, T...SequenceV1>
struct concat_sequence<integer_sequence<T, SequenceV0...>, integer_sequence<T, SequenceV1...>>
: integer_sequence<T, SequenceV0..., (sizeof...(SequenceV0) + SequenceV1)...>{};
// Specialization for index sequences
template<size_t...SequenceV0, size_t...SequenceV1>
struct concat_sequence<index_sequence<SequenceV0...>, index_sequence<SequenceV1...>>
: index_sequence<SequenceV0..., (sizeof...(SequenceV0) + SequenceV1)...>{};
} }

View File

@ -31,6 +31,70 @@
#ifndef FENNEC_LANG_TYPE_TRAITS_H #ifndef FENNEC_LANG_TYPE_TRAITS_H
#define FENNEC_LANG_TYPE_TRAITS_H #define FENNEC_LANG_TYPE_TRAITS_H
///
/// \page fennec_lang_type_traits Type Traits
///
/// \brief Part of the fennec metaprogramming library. This header defines structures for accessing traits of types
/// at compile time.
///
/// \code #include <fennec/lang/type_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_void "is_void<TypeT>::value"<br>
/// \ref fennec::is_void_v "is_void_v<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::is_void
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::is_bool "is_bool<TypeT>::value"<br>
/// \ref fennec::is_bool_v "is_bool_v<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::is_bool
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::is_integral "is_integral<TypeT>::value"<br>
/// \ref fennec::is_integral_v "is_integral_v<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::is_integral
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::is_signed "is_signed<TypeT>::value"<br>
/// \ref fennec::is_signed_v "is_signed_v<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::is_signed
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::is_unsigned "is_unsigned<TypeT>::value"<br>
/// \ref fennec::is_unsigned_v "is_unsigned_v<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::is_unsigned
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::is_floating_point "is_floating_point<TypeT>::value"<br>
/// \ref fennec::is_floating_point_v "is_floating_point_v<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::is_floating_point
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::is_arithmetic "is_arithmetic<TypeT>::value"<br>
/// \ref fennec::is_arithmetic_v "is_arithmetic_v<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::is_arithmetic
///
/// <tr><td width="50%" style="vertical-align: top"> <br>
/// \ref fennec::is_same "is_same<TypeT>::value"<br>
/// \ref fennec::is_same_v "is_same_v<TypeT>"
/// <td width="50%" style="vertical-align: top">
/// \copydetails fennec::is_same
///
/// </table>
///
#include <fennec/lang/type_transforms.h> #include <fennec/lang/type_transforms.h>
#include <fennec/lang/detail/__type_traits.h> #include <fennec/lang/detail/__type_traits.h>
@ -39,16 +103,14 @@ namespace fennec
// fennec::is_void ===================================================================================================== // fennec::is_void =====================================================================================================
///
/// ///
/// \brief check if \p T is of type void /// \brief check if \p T is of type void
/// ///
/// \details /// \details Stores a boolean value in `is_void::value`, representing whether the provided type is of base type void.
/// \tparam T type to check /// \tparam T type to check
template<typename T> struct is_void template<typename T> struct is_void
: detail::__is_void<remove_cvr_t<T>>{}; : detail::__is_void<remove_cvr_t<T>>{};
///
/// ///
/// \brief shorthand for ```is_void<T>::value``` /// \brief shorthand for ```is_void<T>::value```
/// \tparam T type to check /// \tparam T type to check
@ -59,16 +121,14 @@ template<typename T> constexpr bool_t is_void_v
// fennec::is_bool ===================================================================================================== // fennec::is_bool =====================================================================================================
///
/// ///
/// \brief check if \p T is of type bool /// \brief check if \p T is of type bool
/// ///
/// \details /// \details Stores a boolean value in `is_bool::value`, representing whether the provided type is of base type bool.
/// \tparam T type to check /// \tparam T type to check
template<typename T> struct is_bool template<typename T> struct is_bool
: detail::__is_bool<remove_cvr_t<T>>{}; : detail::__is_bool<remove_cvr_t<T>>{};
///
/// ///
/// \brief shorthand for ```is_bool<T>::value``` /// \brief shorthand for ```is_bool<T>::value```
/// \tparam T type to check /// \tparam T type to check
@ -79,16 +139,14 @@ template<typename T> constexpr bool_t is_bool_v
// Integral Types ====================================================================================================== // Integral Types ======================================================================================================
///
/// ///
/// \brief check if \p T is of an integral /// \brief check if \p T is of an integral
/// ///
/// \details /// \details Stores a boolean value in `is_integral::value`, representing whether the provided type is of a base integer type.
/// \tparam T type to check /// \tparam T type to check
template<typename T> struct is_integral template<typename T> struct is_integral
: detail::__is_integral<remove_cvr_t<T>> {}; : detail::__is_integral<remove_cvr_t<T>> {};
///
/// ///
/// \brief shorthand for ```is_integral<T>::value``` /// \brief shorthand for ```is_integral<T>::value```
/// \tparam T type to check /// \tparam T type to check
@ -96,7 +154,6 @@ template<typename T> constexpr bool_t is_integral_v
= is_integral<T>::value; = is_integral<T>::value;
///
/// ///
/// \brief check if \p T is of a signed integral /// \brief check if \p T is of a signed integral
/// ///
@ -105,7 +162,6 @@ template<typename T> constexpr bool_t is_integral_v
template<typename T> struct is_signed template<typename T> struct is_signed
: detail::__is_signed<remove_cvr_t<T>> {}; : detail::__is_signed<remove_cvr_t<T>> {};
///
/// ///
/// \brief shorthand for ```is_signed<T>::value``` /// \brief shorthand for ```is_signed<T>::value```
/// \tparam T type to check /// \tparam T type to check
@ -113,7 +169,6 @@ template<typename T> constexpr bool_t is_signed_v
= is_signed<T>::value; = is_signed<T>::value;
///
/// ///
/// \brief check if \p T is of an unsigned integral /// \brief check if \p T is of an unsigned integral
/// ///
@ -122,7 +177,6 @@ template<typename T> constexpr bool_t is_signed_v
template<typename T> struct is_unsigned template<typename T> struct is_unsigned
: detail::__is_unsigned<remove_cvr_t<T>> {}; : detail::__is_unsigned<remove_cvr_t<T>> {};
///
/// ///
/// \brief shorthand for ```is_unsigned<T>::value``` /// \brief shorthand for ```is_unsigned<T>::value```
/// \tparam T type to check /// \tparam T type to check
@ -133,7 +187,6 @@ template<typename T> constexpr bool_t is_unsigned_v
// Floating Point Types ================================================================================================ // Floating Point Types ================================================================================================
///
/// ///
/// \brief check if \p T is of a floating point type /// \brief check if \p T is of a floating point type
/// ///
@ -142,7 +195,6 @@ template<typename T> constexpr bool_t is_unsigned_v
template<typename T> struct is_floating_point template<typename T> struct is_floating_point
: detail::__is_floating_point<remove_cvr_t<T>>{}; : detail::__is_floating_point<remove_cvr_t<T>>{};
///
/// ///
/// \brief shorthand for ```is_floating_point<T>::value``` /// \brief shorthand for ```is_floating_point<T>::value```
/// \tparam T type to check /// \tparam T type to check
@ -153,7 +205,6 @@ template<typename T> constexpr bool_t is_floating_point_v
// Arithmetic Types ==================================================================================================== // Arithmetic Types ====================================================================================================
///
/// ///
/// \brief check if \p T is an arithmetic type /// \brief check if \p T is an arithmetic type
/// ///
@ -162,7 +213,6 @@ template<typename T> constexpr bool_t is_floating_point_v
template<typename T> struct is_arithmetic template<typename T> struct is_arithmetic
: bool_constant<is_integral_v<T> or is_floating_point_v<T>>{}; : bool_constant<is_integral_v<T> or is_floating_point_v<T>>{};
///
/// ///
/// \brief shorthand for ```is_arithmetic<T>::value``` /// \brief shorthand for ```is_arithmetic<T>::value```
/// \tparam T type to check /// \tparam T type to check
@ -171,7 +221,6 @@ template<typename T> constexpr bool_t is_arithmetic_v
// fennec::is_same ===================================================================================================== // fennec::is_same =====================================================================================================
///
/// ///
/// \brief check if the two types are identical /// \brief check if the two types are identical
/// ///
@ -184,7 +233,6 @@ template<typename T0, typename T1> struct is_same
template<typename T> struct is_same<T, T> template<typename T> struct is_same<T, T>
: true_type {}; : true_type {};
///
/// ///
/// \brief shorthand for ```is_same<T0, T1>::value``` /// \brief shorthand for ```is_same<T0, T1>::value```
/// \tparam T type to check /// \tparam T type to check