Compare commits
No commits in common. "4d8466851c6143fd0e879c06ecd6a91f48a36b63" and "6d3c276bfed1c9fc88fd9fd4a0a24570f5cf3912" have entirely different histories.
4d8466851c
...
6d3c276bfe
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
.*/
|
||||
/build/
|
||||
/docs/
|
||||
/bin/
|
||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "external/sdl"]
|
||||
path = external/sdl
|
||||
url = https://github.com/libsdl-org/SDL.git
|
@ -1,12 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.30)
|
||||
project(fennec)
|
||||
|
||||
# External dependencies should be loaded here
|
||||
|
||||
# SDL is a dependency of the project, added as a git submodule
|
||||
set(SDL_STATIC 1)
|
||||
add_subdirectory(external/sdl)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 26)
|
||||
set(CMAKE_C_STANDARD 26)
|
||||
|
||||
@ -21,8 +15,7 @@ add_subdirectory(metaprogramming)
|
||||
|
||||
string(TOLOWER ${CMAKE_BUILD_TYPE} FENNEC_BUILD_NAME)
|
||||
|
||||
message(STATUS "OS: ${CMAKE_SYSTEM_NAME}")
|
||||
message(STATUS "Build: ${FENNEC_BUILD_NAME}")
|
||||
set(CMAKE_BINARY_DIR ${PROJECT_SOURCE_DIR}/build/${CMAKE_PLATFORM_NO_VERSIONED_SONAME})
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/${FENNEC_BUILD_NAME})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/${FENNEC_BUILD_NAME})
|
||||
@ -39,10 +32,7 @@ add_library(fennec STATIC
|
||||
include/fennec/containers/dynarray.h
|
||||
|
||||
|
||||
# LANG =================================================================================================================
|
||||
include/fennec/lang/lang.h
|
||||
include/fennec/lang/metaprogramming.h
|
||||
|
||||
# LANG =================================================================================================================h
|
||||
include/fennec/lang/bits.h
|
||||
include/fennec/lang/constants.h
|
||||
include/fennec/lang/conditional_types.h
|
||||
@ -54,13 +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/type_sequences.h
|
||||
include/fennec/lang/integer.h
|
||||
include/fennec/lang/variadics.h
|
||||
|
||||
include/fennec/lang/detail/__bits.h
|
||||
include/fennec/lang/detail/__numeric_transforms.h
|
||||
include/fennec/lang/detail/__type_traits.h
|
||||
include/fennec/lang/detail/__type_sequences.h
|
||||
include/fennec/lang/detail/__variadics.h
|
||||
|
||||
|
||||
# MEMORY ===============================================================================================================
|
||||
@ -98,15 +86,16 @@ add_library(fennec STATIC
|
||||
include/fennec/math/detail/__fwd.h
|
||||
include/fennec/math/detail/__types.h
|
||||
include/fennec/math/detail/__vector_traits.h
|
||||
include/fennec/lang/assert.h
|
||||
source/lang/assert.cpp
|
||||
include/fennec/lang/lang.h
|
||||
include/fennec/lang/detail/__bits.h
|
||||
include/fennec/lang/integer.h
|
||||
)
|
||||
|
||||
# add metaprogramming templates as a dependency and also force documentation to be generated when fennec is compiled
|
||||
if(DOXYGEN_FOUND)
|
||||
add_dependencies(fennec fennecdocs metaprogramming SDL3-static)
|
||||
add_dependencies(fennec fennecdocs metaprogramming)
|
||||
else()
|
||||
add_dependencies(fennec metaprogramming SDL3-static)
|
||||
add_dependencies(fennec metaprogramming)
|
||||
endif()
|
||||
|
||||
# Compiler Warning Flags
|
||||
|
14
PLANNING.md
14
PLANNING.md
@ -41,15 +41,6 @@ assertions. **DO NOT USE EXCEPTIONS**.
|
||||
System implementations should be independent of architecture or platforms. i.e. the code of the graphics system should
|
||||
not care if OpenGL or Vulkan is used and should not use any direct calls to OpenGL or Vulkan.
|
||||
|
||||
The engine should not care about the types of objects loaded from a so/dll. In fact, most of the code should
|
||||
be type independent. Any shared information among a collection of objects should be held either implicitly or explicitly
|
||||
in the super-class. It will be the responsibility of the linked code to initialize and cleanup the objects related to it.
|
||||
This principle should extend to the submodules of the engine.
|
||||
|
||||
It is also best to avoid objects having behaviour that is not defined by the system they are in. There are some exceptions
|
||||
in extensions or mods and should be given configurability and programmability within those systems and their stages.
|
||||
This however can be acheived using events at different stages of those engines that are on-demand.
|
||||
|
||||
|
||||
|
||||
|
||||
@ -77,9 +68,6 @@ So far this is implemented on an as-needed basis. A full implementation should b
|
||||
|
||||
Implement math functions according to the [OpenGL 4.6 Shading Language Specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf).
|
||||
|
||||
"Extensions" has a different meaning here. Extensions for the math library are any functions that are not defined within
|
||||
the Specification.
|
||||
|
||||
Additional extensions should be implemented to provide standard definitions for functions predominantly related
|
||||
to Linear Algebra, Mathematical Analysis, and Discrete Analysis. Additional extensions will be implemented on a
|
||||
as-needed basis.
|
||||
@ -119,6 +107,7 @@ Here are essential data-structures not specified in the C++ stdlib:
|
||||
|
||||
## Format Processing (`fproc`)
|
||||
|
||||
No, this won't include Machine Learning, it will mostly include tools for processing human-readable files.
|
||||
fennec should be able to use Doxygen and LaTeX externally. Consider including binaries with releases.
|
||||
|
||||
* String Analysis (`fproc/strings`)
|
||||
@ -178,7 +167,6 @@ This will be the core of the engine.
|
||||
- Event System
|
||||
- Most events will fire at the start of the next tick, especially those related to physics and input.
|
||||
- Events for graphics or audio should propagate immediately.
|
||||
- Events for stages should also propagate immediately, this is to support extensions and mods.
|
||||
- Core Engine Loop
|
||||
- System Manager
|
||||
- Ticks vs. Frames
|
||||
|
1
external/sdl
vendored
1
external/sdl
vendored
@ -1 +0,0 @@
|
||||
Subproject commit d7939abf42de34fff409f5e7c4b77ace79dff4de
|
@ -33,7 +33,8 @@
|
||||
#define FENNEC_CONTAINERS_ARRAY_H
|
||||
|
||||
#include <fennec/lang/types.h>
|
||||
#include <fennec/lang/assert.h>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
@ -1,29 +0,0 @@
|
||||
// =====================================================================================================================
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
#ifndef FENNEC_LANG_ASSERT_H
|
||||
#define FENNEC_LANG_ASSERT_H
|
||||
|
||||
using assert_handler = void (*)(const char *, const char *, int , const char *);
|
||||
|
||||
extern void set_assert_handler(assert_handler handler);
|
||||
|
||||
extern void __assert_impl(const char* expression, const char* file, int line, const char* function);
|
||||
#define assert(expression) if(not(expression)) { __assert_impl(#expression, __FILE__, __LINE__, __PRETTY_FUNCTION__); }
|
||||
|
||||
#endif // FENNEC_LANG_ASSERT_H
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file bits.h
|
||||
/// \brief \ref fennec_lang_bit_manipulation
|
||||
/// \brief bit-wise operations
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file conditional_types.h
|
||||
/// \brief \ref fennec_lang_conditional_types
|
||||
/// \brief metaprogramming to conditionally set a type
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
@ -73,6 +73,7 @@ namespace fennec
|
||||
|
||||
// fennec::conditional =================================================================================================
|
||||
|
||||
///
|
||||
///
|
||||
/// \brief select between two types based on a condition
|
||||
///
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file constants.h
|
||||
/// \brief \ref fennec_lang_constants
|
||||
/// \brief metaprogramming constants
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
|
@ -16,8 +16,8 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
#ifndef FENNEC_LANG_DETAIL_TYPE_SEQUENCES_H
|
||||
#define FENNEC_LANG_DETAIL_TYPE_SEQUENCES_H
|
||||
#ifndef FENNEC_LANG_DETAIL_VARIADICS_H
|
||||
#define FENNEC_LANG_DETAIL_VARIADICS_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_TYPE_SEQUENCES_H
|
||||
#endif // FENNEC_LANG_DETAIL_VARIADICS_H
|
@ -18,7 +18,8 @@
|
||||
|
||||
///
|
||||
/// \file intrinsics.h
|
||||
/// \brief \ref fennec_lang_intrinsics
|
||||
/// \brief This header contains definitions for compiler intrinsics necessary for implementing functions of the
|
||||
/// C++ stdlib.
|
||||
///
|
||||
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||
///
|
||||
@ -33,8 +34,6 @@
|
||||
/// \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
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file lang.h
|
||||
/// \brief \ref fennec_lang
|
||||
/// \brief fennec C++ language library
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
@ -31,12 +31,6 @@
|
||||
#ifndef FENNEC_LANG_H
|
||||
#define FENNEC_LANG_H
|
||||
|
||||
#include <fennec/lang/bits.h>
|
||||
#include <fennec/lang/intrinsics.h>
|
||||
#include <fennec/lang/limits.h>
|
||||
#include <fennec/lang/types.h>
|
||||
#include <fennec/lang/utility.h>
|
||||
|
||||
///
|
||||
/// \page fennec_lang C++ Language Library
|
||||
///
|
||||
@ -47,7 +41,21 @@
|
||||
/// - \subpage fennec_lang_limits
|
||||
/// - \subpage fennec_lang_metaprogramming
|
||||
/// - \subpage fennec_lang_types
|
||||
/// - \subpage fennec_lang_utility
|
||||
///
|
||||
///
|
||||
|
||||
///
|
||||
/// \page fennec_lang_metaprogramming Metaprogramming
|
||||
///
|
||||
/// Metaprogramming is a method of obtaining information about the structure of the code at compile time.
|
||||
/// This includes getting traits of types, such as with \ref fennec::numeric_limits. You may even
|
||||
/// \ref fennec_lang_conditional_types "programmatically enable" functions based on the info of the types that the function uses.
|
||||
///
|
||||
/// - \subpage fennec_lang_constants
|
||||
/// - \subpage fennec_lang_conditional_types
|
||||
/// - \subpage fennec_lang_numeric_transforms
|
||||
/// - \subpage fennec_lang_sequences
|
||||
/// - \subpage fennec_lang_type_traits
|
||||
///
|
||||
///
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file limits.h
|
||||
/// \brief \ref fennec_lang_limits
|
||||
/// \brief contains the limits of builtin data types to C++
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
|
@ -1,52 +0,0 @@
|
||||
// =====================================================================================================================
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
///
|
||||
/// \file metaprogramming.h
|
||||
/// \brief \ref fennec_lang
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
/// \author Medusa Slockbower
|
||||
///
|
||||
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||
///
|
||||
///
|
||||
|
||||
#ifndef FENNEC_LANG_METAPROGRAMMING_H
|
||||
#define FENNEC_LANG_METAPROGRAMMING_H
|
||||
|
||||
///
|
||||
/// \page fennec_lang_metaprogramming Metaprogramming Library
|
||||
///
|
||||
/// This is a sub-library of the fennec \ref fennec_lang. Metaprogramming is a method of obtaining information about the
|
||||
/// structure of the code and changing its behaviour at compile time. This includes getting traits of types, such as with
|
||||
/// \ref fennec::is_signed. You may even \ref fennec_lang_conditional_types "programmatically enable" functions
|
||||
/// based on the info of the types that the function uses.
|
||||
///
|
||||
/// - \subpage fennec_lang_constants
|
||||
/// - \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
|
||||
///
|
||||
///
|
||||
|
||||
#endif // FENNEC_LANG_METAPROGRAMMING_H
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file numeric_transforms.h
|
||||
/// \brief \ref fennec_lang_numeric_transforms
|
||||
/// \brief modify numeric types at compile time
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file sequences.h
|
||||
/// \brief \ref fennec_lang_sequences
|
||||
/// \brief metaprogramming sequences
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file type_traits.h
|
||||
/// \brief \ref fennec_lang_type_traits
|
||||
/// \brief get info about types at compile-time
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
@ -92,18 +92,6 @@
|
||||
/// <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>
|
||||
///
|
||||
|
||||
@ -169,7 +157,7 @@ template<typename T> constexpr bool_t is_integral_v
|
||||
///
|
||||
/// \brief check if \p T is of a signed integral
|
||||
///
|
||||
/// \details Checks if type `T` is a signed type i.e. `T(-1) < T(0)` and stores it in `is_same::value`.
|
||||
/// \details
|
||||
/// \tparam T type to check
|
||||
template<typename T> struct is_signed
|
||||
: detail::__is_signed<remove_cvr_t<T>> {};
|
||||
@ -184,7 +172,7 @@ template<typename T> constexpr bool_t is_signed_v
|
||||
///
|
||||
/// \brief check if \p T is of an unsigned integral
|
||||
///
|
||||
/// \details Checks if type `T` is an unsigned type i.e. `T(-1) > T(0)` and stores it in `is_same::value`.
|
||||
/// \details
|
||||
/// \tparam T type to check
|
||||
template<typename T> struct is_unsigned
|
||||
: detail::__is_unsigned<remove_cvr_t<T>> {};
|
||||
@ -202,7 +190,7 @@ template<typename T> constexpr bool_t is_unsigned_v
|
||||
///
|
||||
/// \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`.
|
||||
/// \details
|
||||
/// \tparam T type to check
|
||||
template<typename T> struct is_floating_point
|
||||
: detail::__is_floating_point<remove_cvr_t<T>>{};
|
||||
@ -220,7 +208,7 @@ template<typename T> constexpr bool_t is_floating_point_v
|
||||
///
|
||||
/// \brief check if \p T is an arithmetic type
|
||||
///
|
||||
/// \details Checks if type `T` is a built-in type with arithmetic operators and store it in `is_same::value`.
|
||||
/// \details
|
||||
/// \tparam T type to check
|
||||
template<typename T> struct is_arithmetic
|
||||
: bool_constant<is_integral_v<T> or is_floating_point_v<T>>{};
|
||||
@ -236,9 +224,8 @@ template<typename T> constexpr bool_t is_arithmetic_v
|
||||
///
|
||||
/// \brief check if the two types are identical
|
||||
///
|
||||
/// \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
|
||||
/// \details
|
||||
/// \tparam T type to check
|
||||
template<typename T0, typename T1> struct is_same
|
||||
: false_type {};
|
||||
|
||||
@ -256,19 +243,17 @@ template<typename T0, typename T1> constexpr bool_t is_same_v
|
||||
|
||||
///
|
||||
/// \brief check if type `T0` can be converted `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)> {};
|
||||
/// \tparam T0 First type
|
||||
/// \tparam T1 Second type
|
||||
template<typename T0, typename T1> struct can_convert
|
||||
: bool_constant<FENNEC_BUILTIN_IS_CONVERTIBLE(T0, T1)> {};
|
||||
|
||||
///
|
||||
/// \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;
|
||||
/// \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;
|
||||
|
||||
|
||||
// fennec::is_constructible ===============================================================================================
|
||||
@ -281,8 +266,6 @@ template<typename FromT, typename ToT> using is_convertible_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...>{};
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file type_transforms.h
|
||||
/// \brief \ref fennec_lang_type_transforms
|
||||
/// \brief modify types at compile time
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
@ -31,100 +31,6 @@
|
||||
#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
|
||||
{
|
||||
|
||||
@ -134,7 +40,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 member type_transform::type
|
||||
/// \details resembles a transformation from one type to T, the result is stored in the typedef type_transform::type
|
||||
/// \tparam T Resultant Type
|
||||
template<typename T> struct type_transform {
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file types.h
|
||||
/// \brief \ref fennec_lang_types
|
||||
/// \brief basic types of the c++ language
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
@ -34,10 +34,10 @@
|
||||
///
|
||||
/// \page fennec_lang_types Types
|
||||
///
|
||||
/// \brief This header contains definitions for the built-in types of the C++ language.
|
||||
/// \brief This header contains definitions for built-in types.
|
||||
///
|
||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_types">
|
||||
/// <tr><th style="vertical-align: top">Type
|
||||
/// <tr><th style="vertical-align: top">Member
|
||||
/// <th style="vertical-align: top">Description
|
||||
///
|
||||
/// <tr><th colspan=2 style="text-align: center;">Basic Types
|
||||
@ -219,182 +219,179 @@
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
// Basic Types =========================================================================================================
|
||||
|
||||
///
|
||||
/// \name Basic Types
|
||||
/// @{
|
||||
// Basic Types =========================================================================================================
|
||||
|
||||
///
|
||||
/// \brief A conditional type
|
||||
using bool_t = bool;
|
||||
///
|
||||
/// \name Basic Types
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// \brief A type capable of holding an ascii value
|
||||
using char_t = char;
|
||||
///
|
||||
/// \brief A conditional type
|
||||
using bool_t = bool;
|
||||
|
||||
///
|
||||
/// \brief A type with the size of a char, capable of holding a signed 8-bit integer
|
||||
using schar_t = signed char;
|
||||
///
|
||||
/// \brief A type capable of holding an ascii value
|
||||
using char_t = char;
|
||||
|
||||
///
|
||||
/// \brief A type with the size of a char, capable of holding an unsigned 8-bit integer
|
||||
using uchar_t = unsigned char;
|
||||
///
|
||||
/// \brief A type with the size of a char, capable of holding a signed 8-bit integer
|
||||
using schar_t = signed char;
|
||||
|
||||
///
|
||||
/// \brief A signed short type, capable of holding signed 16-bit integer
|
||||
using short_t = signed short;
|
||||
///
|
||||
/// \brief A type with the size of a char, capable of holding an unsigned 8-bit integer
|
||||
using uchar_t = unsigned char;
|
||||
|
||||
///
|
||||
/// \brief An unsigned short type, capable of holding an unsigned signed 16-bit integer
|
||||
using ushort_t = unsigned short;
|
||||
///
|
||||
/// \brief A signed short type, capable of holding signed 16-bit integer
|
||||
using short_t = signed short;
|
||||
|
||||
///
|
||||
/// \brief A signed integer type, size varies by implementation, but typically 32-bit
|
||||
using int_t = signed int;
|
||||
///
|
||||
/// \brief An unsigned short type, capable of holding an unsigned signed 16-bit integer
|
||||
using ushort_t = unsigned short;
|
||||
|
||||
///
|
||||
/// \brief An unsigned integer type, size varies by implementation, but typically 32-bit
|
||||
using uint_t = unsigned int;
|
||||
///
|
||||
/// \brief A signed integer type, size varies by implementation, but typically 32-bit
|
||||
using int_t = signed int;
|
||||
|
||||
///
|
||||
/// \brief A signed integer type, with a size of at least 32-bits
|
||||
using long_t = signed long;
|
||||
///
|
||||
/// \brief An unsigned integer type, size varies by implementation, but typically 32-bit
|
||||
using uint_t = unsigned int;
|
||||
|
||||
///
|
||||
/// \brief An unsigned integer type, with a size of at least 32-bits
|
||||
using ulong_t = unsigned long;
|
||||
///
|
||||
/// \brief A signed integer type, with a size of at least 32-bits
|
||||
using long_t = signed long;
|
||||
|
||||
///
|
||||
/// \brief A signed integer type, with a size of 64-bits
|
||||
using llong_t = signed long long;
|
||||
///
|
||||
/// \brief An unsigned integer type, with a size of at least 32-bits
|
||||
using ulong_t = unsigned long;
|
||||
|
||||
///
|
||||
/// \brief An unsigned integer type, with a size of 64-bits
|
||||
using ullong_t = unsigned long long;
|
||||
///
|
||||
/// \brief A signed integer type, with a size of 64-bits
|
||||
using llong_t = signed long long;
|
||||
|
||||
///
|
||||
/// \brief A single-precision floating-point type, typically with a size of 32-bits
|
||||
using float_t = float;
|
||||
///
|
||||
/// \brief An unsigned integer type, with a size of 64-bits
|
||||
using ullong_t = unsigned long long;
|
||||
|
||||
///
|
||||
/// \brief A double-point type, typically with a size of 64-bits
|
||||
using double_t = double;
|
||||
/// @}
|
||||
///
|
||||
/// \brief A single-precision floating-point type, typically with a size of 32-bits
|
||||
using float_t = float;
|
||||
|
||||
///
|
||||
/// \brief A double-point type, typically with a size of 64-bits
|
||||
using double_t = double;
|
||||
/// @}
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// \name Special Types
|
||||
/// @{
|
||||
// Sized Arithmetic Types ==============================================================================================
|
||||
|
||||
///
|
||||
/// \brief Null Pointer Type
|
||||
using nullptr_t = decltype(nullptr);
|
||||
///
|
||||
/// \name Sized Integer Types
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// \brief Signed Integer Capable of Holding a Pointer to void
|
||||
using intptr_t = intptr_t;
|
||||
///
|
||||
/// \brief Signed 8-bit integer
|
||||
using int8_t = schar_t;
|
||||
|
||||
///
|
||||
/// \brief Unsigned Integer Capable of Holding a Pointer to void
|
||||
using uintptr_t = uintptr_t;
|
||||
///
|
||||
/// \brief Signed 16-bit integer
|
||||
using int16_t = short_t;
|
||||
|
||||
///
|
||||
/// \brief Maximum Width Signed Integer Type
|
||||
using intmax_t = __INTMAX_TYPE__;
|
||||
///
|
||||
/// \brief Signed 32-bit integer
|
||||
using int32_t = long_t;
|
||||
|
||||
///
|
||||
/// \brief Maximum Width Unsigned Integer Type
|
||||
using uintmax_t = __UINTMAX_TYPE__;
|
||||
///
|
||||
/// \brief Signed signed 64-bit integer
|
||||
using int64_t = llong_t;
|
||||
|
||||
///
|
||||
/// \brief Unsigned Integer Type Returned By `sizeof`, `sizeof...`, and `alignof`
|
||||
using size_t = __SIZE_TYPE__;
|
||||
|
||||
///
|
||||
/// \brief Signed Integer Type Returned by the Subtraction of two Pointers
|
||||
using ptrdiff_t = __PTRDIFF_TYPE__;
|
||||
|
||||
///
|
||||
/// \brief undefined class for SFINAE
|
||||
class undefined_t;
|
||||
|
||||
///
|
||||
/// \brief Void type used for SFINAE
|
||||
template<typename...>
|
||||
using void_t = void;
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
||||
#include <fennec/lang/conditional_types.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
||||
// Sized Arithmetic Types ==============================================================================================
|
||||
|
||||
///
|
||||
/// \name Sized Integer Types
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// \brief Signed 8-bit integer
|
||||
using int8_t = schar_t;
|
||||
|
||||
///
|
||||
/// \brief Signed 16-bit integer
|
||||
using int16_t = short_t;
|
||||
|
||||
///
|
||||
/// \brief Signed 32-bit integer
|
||||
using int32_t = conditional_t<sizeof(int_t) == 4, int_t, long_t>;
|
||||
|
||||
///
|
||||
/// \brief Signed signed 64-bit integer
|
||||
using int64_t = llong_t;
|
||||
|
||||
/// @}
|
||||
/// @}
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// \name Sized Unsigned Integer Types
|
||||
/// @{
|
||||
///
|
||||
/// \name Sized Unsigned Integer Types
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// \brief Unsigned 8-bit integer
|
||||
using uint8_t = uchar_t;
|
||||
///
|
||||
/// \brief Unsigned 8-bit integer
|
||||
using uint8_t = uchar_t;
|
||||
|
||||
///
|
||||
/// \brief Unsigned 16-bit integer
|
||||
using uint16_t = ushort_t;
|
||||
///
|
||||
/// \brief Unsigned 16-bit integer
|
||||
using uint16_t = ushort_t;
|
||||
|
||||
///
|
||||
/// \brief Unsigned 32-bit integer
|
||||
using uint32_t = conditional_t<sizeof(uint_t) == 4, uint_t, ulong_t>;
|
||||
///
|
||||
/// \brief Unsigned 32-bit integer
|
||||
using uint32_t = ulong_t;
|
||||
|
||||
///
|
||||
/// \brief Unsigned 64-bit integer
|
||||
using uint64_t = ullong_t;
|
||||
///
|
||||
/// \brief Unsigned 64-bit integer
|
||||
using uint64_t = ullong_t;
|
||||
|
||||
/// @}
|
||||
/// @}
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// \name Sized Floating-Point Types
|
||||
/// @{
|
||||
///
|
||||
/// \name Sized Floating-Point Types
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// \brief A single-precision floating-point scalar
|
||||
using float32_t = float_t;
|
||||
///
|
||||
/// \brief A single-precision floating-point scalar
|
||||
using float32_t = float_t;
|
||||
|
||||
///
|
||||
/// \brief A double-precision floating-point scalar
|
||||
using float64_t = double_t;
|
||||
/// @}
|
||||
///
|
||||
/// \brief A double-precision floating-point scalar
|
||||
using float64_t = double_t;
|
||||
/// @}
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// \name Special Types
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// \brief Null Pointer Type
|
||||
using nullptr_t = decltype(nullptr);
|
||||
|
||||
///
|
||||
/// \brief Signed Integer Capable of Holding a Pointer to void
|
||||
using intptr_t = intptr_t;
|
||||
|
||||
///
|
||||
/// \brief Unsigned Integer Capable of Holding a Pointer to void
|
||||
using uintptr_t = uintptr_t;
|
||||
|
||||
///
|
||||
/// \brief Maximum Width Signed Integer Type
|
||||
using intmax_t = __INTMAX_TYPE__;
|
||||
|
||||
///
|
||||
/// \brief Maximum Width Unsigned Integer Type
|
||||
using uintmax_t = __UINTMAX_TYPE__;
|
||||
|
||||
///
|
||||
/// \brief Unsigned Integer Type Returned By `sizeof`, `sizeof...`, and `alignof`
|
||||
using size_t = __SIZE_TYPE__;
|
||||
|
||||
///
|
||||
/// \brief Signed Integer Type Returned by the Subtraction of two Pointers
|
||||
using ptrdiff_t = __PTRDIFF_TYPE__;
|
||||
|
||||
///
|
||||
/// \brief undefined class for SFINAE
|
||||
class undefined_t;
|
||||
|
||||
///
|
||||
/// \brief Void type used for SFINAE
|
||||
template<typename...>
|
||||
using void_t = void;
|
||||
|
||||
/// @}
|
||||
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file utility.h
|
||||
/// \brief \ref fennec_lang_utility
|
||||
/// \brief common utility functions related to the c++ language
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
@ -31,67 +31,46 @@
|
||||
#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 forwards reference types to extend their lifetime
|
||||
/// \details
|
||||
/// \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; }
|
||||
|
||||
// specialization for T&&
|
||||
///
|
||||
///
|
||||
/// \brief forwards reference types to extend their lifetime
|
||||
///
|
||||
/// \details
|
||||
/// \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 produces an x-value type to indicate \p x may be "moved"
|
||||
///
|
||||
/// \details produces an x-value type to indicate \p x may be "moved"
|
||||
/// \details
|
||||
/// \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 produces an r-value type to indicate \p x may be "copied"
|
||||
/// \details
|
||||
/// \tparam T base type of the object
|
||||
/// \param x object to be copied
|
||||
/// \returns const r-value
|
||||
|
@ -17,8 +17,8 @@
|
||||
// =====================================================================================================================
|
||||
|
||||
///
|
||||
/// \file type_sequences.h
|
||||
/// \brief \ref fennec_lang_type_sequences
|
||||
/// \file variadics.h
|
||||
/// \brief basic types of the c++ language
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
@ -28,35 +28,10 @@
|
||||
///
|
||||
///
|
||||
|
||||
#ifndef FENNEC_LANG_TYPE_SEQUENCES_H
|
||||
#define FENNEC_LANG_TYPE_SEQUENCES_H
|
||||
#ifndef FENNEC_LANG_VARIADICS_H
|
||||
#define FENNEC_LANG_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>
|
||||
#include <fennec/lang/detail/__variadics.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file math.h
|
||||
/// \brief fennec Math Library
|
||||
/// \brief main math header which includes the main modules
|
||||
///
|
||||
///
|
||||
/// \details This header includes the following modules of \ref fennec_math :
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file swizzle.h
|
||||
/// \brief \ref fennec_math_swizzle
|
||||
/// \brief part of the \ref fennec_math_vector,
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
///
|
||||
/// \file vector_traits.h
|
||||
/// \brief
|
||||
/// \brief part of the \ref fennec_math_vector
|
||||
///
|
||||
///
|
||||
/// \details this header implements functions to test vector types at compile time
|
||||
@ -31,39 +31,6 @@
|
||||
#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
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <fennec/lang/conditional_types.h>
|
||||
#include <fennec/lang/types.h>
|
||||
#include <fennec/lang/type_traits.h>
|
||||
#include <fennec/lang/type_sequences.h>
|
||||
#include <fennec/lang/variadics.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ struct default_delete
|
||||
///
|
||||
/// \brief Conversion Constructor
|
||||
/// \tparam ConvT of other deleter
|
||||
template<class ConvT> requires requires { is_convertible<ConvT*, TypeT*>{}.value == true; }
|
||||
template<class ConvT> requires requires { can_convert<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 { is_convertible<ConvT(*)[], TypeT(*)[]>{}.value == true; }
|
||||
template<class ConvT> requires requires { can_convert<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 { is_convertible<ArrT(*)[], TypeT(*)[]>{}.value == true; }
|
||||
template<class ArrT> requires requires { can_convert<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");
|
||||
|
@ -1,36 +0,0 @@
|
||||
// =====================================================================================================================
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
using assert_handler = void (*)(const char *, const char *, int , const char *);
|
||||
|
||||
static assert_handler __priv_handler = nullptr;
|
||||
|
||||
void set_assert_handler(assert_handler handler)
|
||||
{
|
||||
__priv_handler = handler;
|
||||
}
|
||||
|
||||
void __assert_impl(const char* expression, const char* file, int line, const char* function)
|
||||
{
|
||||
if (__priv_handler)
|
||||
__priv_handler(expression, file, line, function);
|
||||
|
||||
abort();
|
||||
}
|
12
test.sh
12
test.sh
@ -41,8 +41,7 @@ Debug()
|
||||
cd ./build/debug
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -S ../.. -B .
|
||||
cmake --build . --target fennec-test
|
||||
cd ../../bin/debug/
|
||||
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt fennec-test
|
||||
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt ./test/fennec-test
|
||||
cd ../..
|
||||
}
|
||||
|
||||
@ -52,8 +51,7 @@ Release()
|
||||
cd ./build/release
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -S ../.. -B .
|
||||
cmake --build . --target fennec-test
|
||||
cd ../../bin/release/
|
||||
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt fennec-test
|
||||
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt ./test/fennec-test
|
||||
cd ../..
|
||||
}
|
||||
|
||||
@ -63,8 +61,7 @@ RelWithDebInfo()
|
||||
cd ./build/relwithdebinfo
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -S ../.. -B .
|
||||
cmake --build . --target fennec-test
|
||||
cd ../../bin/relwithdebinfo/
|
||||
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt fennec-test
|
||||
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt ./test/fennec-test
|
||||
cd ../..
|
||||
}
|
||||
|
||||
@ -74,8 +71,7 @@ MinSizeRel()
|
||||
cd ./build/minsizerel
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -S ../.. -B .
|
||||
cmake --build . --target fennec-test
|
||||
cd ../../bin/minsizerel/
|
||||
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt fennec-test
|
||||
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt ./test/fennec-test
|
||||
cd ../..
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,7 @@ add_executable(fennec-test main.cpp
|
||||
tests/test_memory.h
|
||||
tests/test_math.h
|
||||
tests/test_lang.h
|
||||
tests/lang/test_conditional_types.h
|
||||
tests/lang/test_bits.h
|
||||
tests/lang/conditional_types.h
|
||||
)
|
||||
|
||||
target_link_libraries(fennec-test PRIVATE
|
||||
|
@ -31,11 +31,6 @@ int main(int, char **)
|
||||
|
||||
fennec_test_spacer(2);
|
||||
|
||||
fennec_test_header("c++ language library");
|
||||
fennec_test_spacer(2);
|
||||
fennec::test::fennec_test_lang();
|
||||
fennec_test_spacer(3);
|
||||
|
||||
fennec_test_header("math library");
|
||||
fennec_test_spacer(2);
|
||||
fennec::test::fennec_test_math();
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
#include <fennec/lang/limits.h>
|
||||
#include <fennec/math/common.h>
|
||||
@ -67,7 +68,7 @@ inline bool operator<=(const vector<ScalarT, IndicesV...>& lhs, const vector<Sca
|
||||
}
|
||||
|
||||
template<typename ResultT>
|
||||
inline void __fennec_test_run(const std::string& expression, const ResultT result, const ResultT expected)
|
||||
inline void __fennec_test_run(const std::string& expression, ResultT result, ResultT expected)
|
||||
{
|
||||
std::cout << std::boolalpha;
|
||||
std::cout << '\t' << expression << " = " << result;
|
||||
|
@ -19,19 +19,6 @@
|
||||
#ifndef FENNEC_TEST_LANG_CONDITIONAL_TYPES_H
|
||||
#define FENNEC_TEST_LANG_CONDITIONAL_TYPES_H
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
||||
namespace test
|
||||
{
|
||||
|
||||
inline void fennec_test_lang_conditional_types()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // FENNEC_TEST_LANG_CONDITIONAL_TYPES_H
|
@ -1,49 +0,0 @@
|
||||
// =====================================================================================================================
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
#ifndef FENNEC_TEST_LANG_BITS_H
|
||||
#define FENNEC_TEST_LANG_BITS_H
|
||||
|
||||
#include <fennec/lang/assert.h>
|
||||
#include <fennec/lang/bits.h>
|
||||
|
||||
#include "../../test.h"
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
||||
namespace test
|
||||
{
|
||||
|
||||
void fennec_test_lang_bits()
|
||||
{
|
||||
int a = 0x48ef13ad;
|
||||
int b = 0x23e5ab9c;
|
||||
|
||||
fennec_test_run(fennec::bit_cast<float>(0x3ee00000), 0.4375f);
|
||||
|
||||
fennec_test_run(*static_cast<int*>(fennec::bit_and(&a, &b, sizeof(int))), 0x48ef13ad & 0x23e5ab9c);
|
||||
fennec_test_run(*static_cast<int*>(fennec::bit_or(&a, &b, sizeof(int))), (0x48ef13ad & 0x23e5ab9c) | 0x23e5ab9c);
|
||||
fennec_test_run(*static_cast<int*>(fennec::bit_xor(&a, &b, sizeof(int))), ((0x48ef13ad & 0x23e5ab9c) | 0x23e5ab9c) ^ 0x23e5ab9c);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // FENNEC_TEST_LANG_BITS_H
|
@ -33,6 +33,8 @@ namespace test
|
||||
|
||||
inline void fennec_test_math_geometric()
|
||||
{
|
||||
/*
|
||||
fennec_test_spacer(1);
|
||||
|
||||
fennec_test_run(fennec::dot(vec2(1, 2), vec2(1, 2)), 5.0f);
|
||||
fennec_test_run(fennec::dot(vec3(1, 2, 3), vec3(1, 2, 3)), 14.0f);
|
||||
@ -67,7 +69,7 @@ inline void fennec_test_math_geometric()
|
||||
fennec_test_run(fennec::normalize(vec2(1, 1)), vec2(sqrt(2.0f) / 2.0f, sqrt(2.0f) / 2.0f));
|
||||
fennec_test_run(fennec::normalize(vec3(1, 1, 1)), vec3(sqrt(3.0f) / 3.0f, sqrt(3.0f) / 3.0f, sqrt(3.0f) / 3.0f));
|
||||
fennec_test_run(fennec::normalize(vec4(1, 1, 1, 1)), vec4(0.5f, 0.5f, 0.5f, 0.5f));
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,25 +19,4 @@
|
||||
#ifndef FENNEC_TEST_LANG_H
|
||||
#define FENNEC_TEST_LANG_H
|
||||
|
||||
#include "lang/test_bits.h"
|
||||
#include "lang/test_conditional_types.h"
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
||||
namespace test
|
||||
{
|
||||
|
||||
inline void fennec_test_lang()
|
||||
{
|
||||
fennec_test_subheader("bit tests");
|
||||
fennec_test_spacer(2);
|
||||
fennec_test_lang_bits();
|
||||
fennec_test_spacer(3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // FENNEC_TEST_LANG_H
|
||||
|
@ -32,6 +32,7 @@ namespace test
|
||||
|
||||
inline void fennec_test_math()
|
||||
{
|
||||
|
||||
fennec_test_subheader("scalar tests");
|
||||
fennec_test_spacer(2);
|
||||
fennec_test_math_scalar();
|
||||
|
Loading…
x
Reference in New Issue
Block a user