- Basic RTTI type data with inheritance.
This commit is contained in:
102
CMakeLists.txt
102
CMakeLists.txt
@@ -90,17 +90,20 @@ add_library(fennec STATIC
|
|||||||
|
|
||||||
|
|
||||||
# SCENE ================================================================================================================
|
# SCENE ================================================================================================================
|
||||||
include/fennec/scene/scene.h
|
include/fennec/scene/scene.h source/scene/scene.cpp
|
||||||
include/fennec/scene/component.h
|
include/fennec/scene/component.h
|
||||||
include/fennec/scene/scene_node.h
|
include/fennec/scene/scene_node.h
|
||||||
include/fennec/scene/node2d.h
|
include/fennec/scene/node2d.h
|
||||||
|
include/fennec/scene/forward.h
|
||||||
|
|
||||||
|
|
||||||
# Renderers ============================================================================================================
|
|
||||||
|
# RENDERERS ============================================================================================================
|
||||||
include/fennec/renderers/interface/forward.h
|
include/fennec/renderers/interface/forward.h
|
||||||
|
|
||||||
include/fennec/renderers/interface/gfxcontext.h
|
include/fennec/renderers/interface/gfxcontext.h
|
||||||
include/fennec/renderers/interface/gfxsubpass.h
|
include/fennec/renderers/interface/gfxsubpass.h
|
||||||
|
include/fennec/renderers/interface/gfxresourcepool.h
|
||||||
|
|
||||||
|
|
||||||
# CONTAINERS ===========================================================================================================
|
# CONTAINERS ===========================================================================================================
|
||||||
@@ -128,40 +131,48 @@ add_library(fennec STATIC
|
|||||||
include/fennec/containers/detail/_tuple.h
|
include/fennec/containers/detail/_tuple.h
|
||||||
|
|
||||||
|
|
||||||
# LANG =================================================================================================================
|
# langcpp =================================================================================================================
|
||||||
include/fennec/lang/lang.h
|
include/fennec/langcpp/lang.h
|
||||||
include/fennec/lang/metaprogramming.h
|
include/fennec/langcpp/metaprogramming.h
|
||||||
|
|
||||||
include/fennec/lang/bits.h
|
include/fennec/langcpp/bits.h
|
||||||
include/fennec/lang/constants.h
|
include/fennec/langcpp/constants.h
|
||||||
include/fennec/lang/conditional_types.h
|
include/fennec/langcpp/conditional_types.h
|
||||||
include/fennec/lang/hashing.h
|
include/fennec/langcpp/hashing.h
|
||||||
include/fennec/lang/intrinsics.h
|
include/fennec/langcpp/intrinsics.h
|
||||||
include/fennec/lang/limits.h
|
include/fennec/langcpp/limits.h
|
||||||
include/fennec/lang/numeric_transforms.h
|
include/fennec/langcpp/numeric_transforms.h
|
||||||
include/fennec/lang/const_sequences.h
|
include/fennec/langcpp/const_sequences.h
|
||||||
include/fennec/lang/startup.h
|
include/fennec/langcpp/startup.h
|
||||||
include/fennec/lang/type_identity.h
|
include/fennec/langcpp/type_identity.h
|
||||||
include/fennec/lang/type_operators.h
|
include/fennec/langcpp/type_operators.h
|
||||||
include/fennec/lang/type_sequences.h
|
include/fennec/langcpp/type_sequences.h
|
||||||
include/fennec/lang/type_traits.h
|
include/fennec/langcpp/type_traits.h
|
||||||
include/fennec/lang/type_transforms.h
|
include/fennec/langcpp/type_transforms.h
|
||||||
include/fennec/lang/typed.h
|
include/fennec/langcpp/types.h
|
||||||
include/fennec/lang/types.h
|
include/fennec/langcpp/utility.h
|
||||||
include/fennec/lang/utility.h
|
include/fennec/langcpp/integer.h
|
||||||
include/fennec/lang/integer.h
|
|
||||||
|
|
||||||
include/fennec/lang/assert.h source/lang/assert.cpp
|
include/fennec/langcpp/assert.h source/langcpp/assert.cpp
|
||||||
|
|
||||||
|
|
||||||
include/fennec/lang/detail/_bits.h
|
include/fennec/langcpp/detail/_bits.h
|
||||||
include/fennec/lang/detail/_int.h
|
include/fennec/langcpp/detail/_int.h
|
||||||
include/fennec/lang/detail/_numeric_transforms.h
|
include/fennec/langcpp/detail/_numeric_transforms.h
|
||||||
include/fennec/lang/detail/_stdlib.h
|
include/fennec/langcpp/detail/_stdlib.h
|
||||||
include/fennec/lang/detail/_type_traits.h
|
include/fennec/langcpp/detail/_type_traits.h
|
||||||
include/fennec/lang/detail/_type_transforms.h
|
include/fennec/langcpp/detail/_type_transforms.h
|
||||||
include/fennec/lang/detail/_type_sequences.h
|
include/fennec/langcpp/detail/_type_sequences.h
|
||||||
include/fennec/lang/detail/_typeuuid.h
|
|
||||||
|
|
||||||
|
# RTTI =================================================================================================================
|
||||||
|
include/fennec/rtti/typeid.h
|
||||||
|
include/fennec/rtti/type_data.h
|
||||||
|
|
||||||
|
|
||||||
|
include/fennec/rtti/detail/_typeid.h
|
||||||
|
include/fennec/rtti/detail/_type_name.h
|
||||||
|
include/fennec/rtti/detail/_constants.h
|
||||||
|
|
||||||
|
|
||||||
# MEMORY ===============================================================================================================
|
# MEMORY ===============================================================================================================
|
||||||
@@ -216,22 +227,22 @@ add_library(fennec STATIC
|
|||||||
include/fennec/math/detail/_vector_traits.h
|
include/fennec/math/detail/_vector_traits.h
|
||||||
|
|
||||||
|
|
||||||
# langproc ================================================================================================================
|
# lang ================================================================================================================
|
||||||
|
|
||||||
# Strings
|
# Strings
|
||||||
include/fennec/langproc/strings/locale.h
|
include/fennec/lang/strings/locale.h
|
||||||
include/fennec/langproc/strings/cstring.h
|
include/fennec/lang/strings/cstring.h
|
||||||
include/fennec/langproc/strings/string.h
|
include/fennec/lang/strings/string.h
|
||||||
include/fennec/langproc/strings/format.h
|
include/fennec/lang/strings/format.h
|
||||||
|
|
||||||
include/fennec/langproc/strings/detail/_ctype.h
|
include/fennec/lang/strings/detail/_ctype.h
|
||||||
|
|
||||||
# Filesystem
|
# Filesystem
|
||||||
include/fennec/langproc/filesystem/file.h source/langproc/filesystem/file.cpp
|
include/fennec/lang/filesystem/file.h source/lang/filesystem/file.cpp
|
||||||
include/fennec/langproc/filesystem/path.h source/langproc/filesystem/path.cpp
|
include/fennec/lang/filesystem/path.h source/lang/filesystem/path.cpp
|
||||||
|
|
||||||
# Compile
|
# Compile
|
||||||
include/fennec/langproc/compile/tokenizer.h
|
include/fennec/lang/compile/tokenizer.h
|
||||||
|
|
||||||
|
|
||||||
# PLATFORM =============================================================================================================
|
# PLATFORM =============================================================================================================
|
||||||
@@ -240,14 +251,17 @@ add_library(fennec STATIC
|
|||||||
include/fennec/platform/interface/platform.h source/platform/interface/platform.cpp
|
include/fennec/platform/interface/platform.h source/platform/interface/platform.cpp
|
||||||
include/fennec/platform/interface/window.h
|
include/fennec/platform/interface/window.h
|
||||||
|
|
||||||
# RENDERER =============================================================================================================
|
# GRAPHICS =============================================================================================================
|
||||||
|
|
||||||
include/fennec/renderers/interface/gfxresourcepool.h
|
include/fennec/gfx3d/mesh_instance.h
|
||||||
|
|
||||||
# EXTRA SOURCES ========================================================================================================
|
# EXTRA SOURCES ========================================================================================================
|
||||||
|
|
||||||
${FENNEC_EXTRA_SOURCES}
|
${FENNEC_EXTRA_SOURCES}
|
||||||
include/fennec/gfx3d/mesh_instance.h
|
include/fennec/rtti/type.h
|
||||||
|
include/fennec/rtti/enable.h
|
||||||
|
include/fennec/rtti/forward.h
|
||||||
|
include/fennec/rtti/typelist.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_dependencies(fennec metaprogramming fennec-dependencies)
|
add_dependencies(fennec metaprogramming fennec-dependencies)
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ fennec Standards:
|
|||||||
|
|
||||||
- Header Guards should be implemented using `#ifndef`, `#define`, and `#endif` for portability.
|
- Header Guards should be implemented using `#ifndef`, `#define`, and `#endif` for portability.
|
||||||
The naming convention for Header Guards is as follows: `<APP_NAME>_<DIRECTORY_PATH>_<FILE_NAME>_H`.
|
The naming convention for Header Guards is as follows: `<APP_NAME>_<DIRECTORY_PATH>_<FILE_NAME>_H`.
|
||||||
I.E. the engine file `fennec/lang/utility.h` has the Header Guard `FENNEC_LANG_UTILITY_H`.
|
I.E. the engine file `fennec/langcpp/utility.h` has the Header Guard `FENNEC_LANG_UTILITY_H`.
|
||||||
|
|
||||||
* Helper Functions, in the case of classes, should be private.
|
* Helper Functions, in the case of classes, should be private.
|
||||||
In the case of global functions, helpers should be placed in a similarly named file in a subdirectory and namespace
|
In the case of global functions, helpers should be placed in a similarly named file in a subdirectory and namespace
|
||||||
|
|||||||
@@ -22,4 +22,9 @@ add_compile_options("-Wall" "-Wextra" "-pedantic" "-Werror" "-fms-extensions")
|
|||||||
|
|
||||||
fennec_add_link_options("-nostdlib" "-fno-exceptions" "-fno-rtti" "-fdiagnostics-all-candidates")
|
fennec_add_link_options("-nostdlib" "-fno-exceptions" "-fno-rtti" "-fdiagnostics-all-candidates")
|
||||||
|
|
||||||
fennec_add_definitions(_GLIBCXX_INCLUDE_NEXT_C_HEADERS=1 FENNEC_COMPILER_GCC=1 FENNEC_NO_INLINE=[[gnu::noinline]])
|
fennec_add_definitions(
|
||||||
|
_GLIBCXX_INCLUDE_NEXT_C_HEADERS=1
|
||||||
|
FENNEC_COMPILER_GCC=1
|
||||||
|
FENNEC_NO_INLINE=[[gnu::noinline]]
|
||||||
|
FENNEC_FUNCTION_NAME=__PRETTY_FUNCTION__
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- HTML header for doxygen 1.9.8-->
|
<!-- HTML header for doxygen 1.9.8-->
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="$langISO">
|
<html xmlns="http://www.w3.org/1999/xhtml" langcpp="$langISO">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
#ifndef FENNEC_CONTAINERS_ARRAY_H
|
#ifndef FENNEC_CONTAINERS_ARRAY_H
|
||||||
#define FENNEC_CONTAINERS_ARRAY_H
|
#define FENNEC_CONTAINERS_ARRAY_H
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/lang/assert.h>
|
#include <fennec/langcpp/assert.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
#ifndef FENNEC_CONTAINERS_DETAIL_TUPLE_H
|
#ifndef FENNEC_CONTAINERS_DETAIL_TUPLE_H
|
||||||
#define FENNEC_CONTAINERS_DETAIL_TUPLE_H
|
#define FENNEC_CONTAINERS_DETAIL_TUPLE_H
|
||||||
#include <fennec/lang/const_sequences.h>
|
#include <fennec/langcpp/const_sequences.h>
|
||||||
#include <fennec/lang/utility.h>
|
#include <fennec/langcpp/utility.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,8 @@
|
|||||||
#ifndef FENNEC_CONTAINERS_DYNARRAY_H
|
#ifndef FENNEC_CONTAINERS_DYNARRAY_H
|
||||||
#define FENNEC_CONTAINERS_DYNARRAY_H
|
#define FENNEC_CONTAINERS_DYNARRAY_H
|
||||||
|
|
||||||
#include <fennec/lang/utility.h>
|
#include <initializer_list>
|
||||||
|
#include <fennec/langcpp/utility.h>
|
||||||
#include <fennec/memory/allocator.h>
|
#include <fennec/memory/allocator.h>
|
||||||
#include <fennec/memory/new.h>
|
#include <fennec/memory/new.h>
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ namespace fennec
|
|||||||
///
|
///
|
||||||
/// \tparam TypeT value type
|
/// \tparam TypeT value type
|
||||||
template<class TypeT, class Alloc = allocator<TypeT>>
|
template<class TypeT, class Alloc = allocator<TypeT>>
|
||||||
class dynarray {
|
struct dynarray {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Definitions =========================================================================================================
|
// Definitions =========================================================================================================
|
||||||
@@ -174,6 +175,51 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Array Copy Constructor
|
||||||
|
/// \tparam N The length of the array, automatically deduced
|
||||||
|
/// \param arr The array to copy
|
||||||
|
template<size_t N>
|
||||||
|
constexpr dynarray(const TypeT (&arr)[N])
|
||||||
|
: _alloc(N)
|
||||||
|
, _size(N) {
|
||||||
|
for (size_t i = 0; i < N; ++i) {
|
||||||
|
_alloc[i] = arr[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Array Move Constructor
|
||||||
|
/// \tparam N The length of the array, automatically deduced
|
||||||
|
/// \param arr The array to move
|
||||||
|
template<size_t N>
|
||||||
|
constexpr dynarray(TypeT (&&arr)[N])
|
||||||
|
: _alloc(N)
|
||||||
|
, _size(N) {
|
||||||
|
for (size_t i = 0; i < N; ++i) {
|
||||||
|
_alloc[i] = fennec::move(arr[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename OTypeT, class OAlloc>
|
||||||
|
constexpr dynarray(const dynarray<OTypeT, OAlloc>& conv)
|
||||||
|
: _alloc(conv.size())
|
||||||
|
, _size(conv.size()) {
|
||||||
|
size_t i = 0;
|
||||||
|
for (const auto& it : conv) {
|
||||||
|
fennec::construct(&_alloc[i++], it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr dynarray(std::initializer_list<value_t> l, const alloc_t& alloc = alloc_t())
|
||||||
|
: _alloc(l.size(), alloc)
|
||||||
|
, _size(l.size()) {
|
||||||
|
size_t i = 0;
|
||||||
|
for (auto& it : l) {
|
||||||
|
fennec::construct(&_alloc[i++], fennec::move(it));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \brief Copy Constructor, uses the copy constructor to copy each element
|
/// \brief Copy Constructor, uses the copy constructor to copy each element
|
||||||
/// \param arr the dynarray to copy
|
/// \param arr the dynarray to copy
|
||||||
@@ -236,6 +282,36 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Array Copy Assignment Operator
|
||||||
|
/// \tparam N the length of the array
|
||||||
|
/// \param arr the array to copy
|
||||||
|
/// \returns A dynarray after having copied each element of `arr`
|
||||||
|
template<size_t N>
|
||||||
|
constexpr dynarray& operator=(const TypeT (&arr)[N]) {
|
||||||
|
this->clear();
|
||||||
|
_alloc.creallocate(_size = N);
|
||||||
|
for (size_t i = 0; i < _size; ++i) {
|
||||||
|
fennec::construct(&_alloc[i], fennec::copy(arr[i]));
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Array Copy Assignment Operator
|
||||||
|
/// \tparam N the length of the array
|
||||||
|
/// \param arr the array to copy
|
||||||
|
/// \returns A dynarray after having moved each element of `arr`
|
||||||
|
template<size_t N>
|
||||||
|
constexpr dynarray& operator=(TypeT (&&arr)[N]) {
|
||||||
|
this->clear();
|
||||||
|
_alloc.creallocate(_size = N);
|
||||||
|
for (size_t i = 0; i < _size; ++i) {
|
||||||
|
fennec::construct(&_alloc[i], fennec::move(arr[i]));
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
// Properties ==========================================================================================================
|
// Properties ==========================================================================================================
|
||||||
|
|||||||
@@ -291,7 +291,9 @@ private:
|
|||||||
~U() {
|
~U() {
|
||||||
fennec::destruct(&root);
|
fennec::destruct(&root);
|
||||||
}
|
}
|
||||||
} trick = { .root = { KeyT(fennec::forward<ArgsT>(args)...), 0 } };
|
} trick = {
|
||||||
|
.root = { KeyT(fennec::forward<ArgsT>(args)...), 0 }
|
||||||
|
};
|
||||||
return _set.find(trick.val);
|
return _set.find(trick.val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,10 +31,10 @@
|
|||||||
#ifndef FENNEC_CONTAINERS_OPTIONAL_H
|
#ifndef FENNEC_CONTAINERS_OPTIONAL_H
|
||||||
#define FENNEC_CONTAINERS_OPTIONAL_H
|
#define FENNEC_CONTAINERS_OPTIONAL_H
|
||||||
|
|
||||||
#include <fennec/lang/utility.h>
|
#include <fennec/langcpp/utility.h>
|
||||||
#include <fennec/memory/new.h>
|
#include <fennec/memory/new.h>
|
||||||
|
|
||||||
#include <fennec/lang/assert.h>
|
#include <fennec/langcpp/assert.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
#define FENNEC_CONTAINERS_PAIR_H
|
#define FENNEC_CONTAINERS_PAIR_H
|
||||||
|
|
||||||
#include <fennec/containers/tuple.h>
|
#include <fennec/containers/tuple.h>
|
||||||
#include <fennec/lang/hashing.h>
|
#include <fennec/langcpp/hashing.h>
|
||||||
#include <fennec/lang/utility.h>
|
#include <fennec/langcpp/utility.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
#define FENNEC_CONTAINERS_PRIORITY_QUEUE_H
|
#define FENNEC_CONTAINERS_PRIORITY_QUEUE_H
|
||||||
|
|
||||||
#include <fennec/containers/object_pool.h>
|
#include <fennec/containers/object_pool.h>
|
||||||
#include <fennec/lang/compare.h>
|
#include <fennec/langcpp/compare.h>
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/memory/allocator.h>
|
#include <fennec/memory/allocator.h>
|
||||||
|
|
||||||
// Binary heaps are just kinda busted.
|
// Binary heaps are just kinda busted.
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
#include <fennec/containers/list.h>
|
#include <fennec/containers/list.h>
|
||||||
#include <fennec/containers/optional.h>
|
#include <fennec/containers/optional.h>
|
||||||
#include <fennec/containers/traversal.h>
|
#include <fennec/containers/traversal.h>
|
||||||
|
#include <fennec/containers/pair.h>
|
||||||
|
|
||||||
#include <fennec/memory/allocator.h>
|
#include <fennec/memory/allocator.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
@@ -194,7 +196,7 @@ public:
|
|||||||
/// \param i The id of the node to check
|
/// \param i The id of the node to check
|
||||||
/// \returns The id of the child node
|
/// \returns The id of the child node
|
||||||
constexpr size_t child(size_t i, size_t n = 0) const {
|
constexpr size_t child(size_t i, size_t n = 0) const {
|
||||||
if (i >= _table.capacity()) return npos;
|
if (i >= _table.capacity() && n != npos) return npos;
|
||||||
size_t c = i == npos ? npos : _table[i].child;
|
size_t c = i == npos ? npos : _table[i].child;
|
||||||
if (n != 0)
|
if (n != 0)
|
||||||
return next(c, n == npos ? npos : n - 1);
|
return next(c, n == npos ? npos : n - 1);
|
||||||
@@ -205,7 +207,7 @@ public:
|
|||||||
/// \param i The id of the node to check
|
/// \param i The id of the node to check
|
||||||
/// \returns The id of the next node
|
/// \returns The id of the next node
|
||||||
constexpr size_t next(size_t i, size_t n = 0) const {
|
constexpr size_t next(size_t i, size_t n = 0) const {
|
||||||
if (i >= _table.capacity()) return npos;
|
if (i >= _table.capacity() && n != npos) return npos;
|
||||||
if (i == npos) {
|
if (i == npos) {
|
||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
@@ -332,7 +334,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// \brief Insertion, creates a node in the tree with parent `parent`
|
/// \brief Insertion, creates a node in the tree with parent `parent`
|
||||||
/// \param parent the parent node, if `npos` sets the value of the root node
|
/// \param parent the parent node, if `npos` sets the value of the root node
|
||||||
/// \param next the next node, as an index relative to the parent
|
/// \param next the next node, as an index relative to the parent, i.e. parent[0] == parent.child, parent[1] == parent.child.next
|
||||||
/// \param val the value to insert
|
/// \param val the value to insert
|
||||||
/// \returns the index of the created node
|
/// \returns the index of the created node
|
||||||
constexpr size_t insert(size_t parent, size_t next, const value_t& val) {
|
constexpr size_t insert(size_t parent, size_t next, const value_t& val) {
|
||||||
@@ -349,10 +351,33 @@ public:
|
|||||||
return this->_insert(parent, next, fennec::forward<value_t>(val));
|
return this->_insert(parent, next, fennec::forward<value_t>(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr size_t insert(size_t parent, size_t next, const rdtree& tree) {
|
||||||
|
list<pair<size_t, size_t>> visit;
|
||||||
|
visit.push_front({ root, parent });
|
||||||
|
size_t res = npos;
|
||||||
|
|
||||||
|
while (not visit.empty()) {
|
||||||
|
auto node = visit.front();
|
||||||
|
visit.pop_front();
|
||||||
|
|
||||||
|
size_t p = this->_insert(node.second, node.second == parent ? next : npos, tree[node.first]);
|
||||||
|
|
||||||
|
res = (res == npos) ? p : res;
|
||||||
|
|
||||||
|
size_t c = tree.child(node.first, npos);
|
||||||
|
while (c != npos) {
|
||||||
|
visit.push_front({ c, p });
|
||||||
|
c = tree._table[c].prev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \brief Insertion, creates a node in the tree with parent `parent`
|
/// \brief Insertion, creates a node in the tree with parent `parent`
|
||||||
/// \param parent the parent node, if `npos` sets the value of the root node
|
/// \param parent the parent node, if `npos` sets the value of the root node
|
||||||
/// \param next the next node, as an index relative to the parent
|
/// \param next the next node, as an index relative to the parent, i.e. parent[0] == parent.child, parent[1] == parent.child.next
|
||||||
/// \param args the args to construct the value to insert
|
/// \param args the args to construct the value to insert
|
||||||
/// \returns the index of the created node
|
/// \returns the index of the created node
|
||||||
template<typename...ArgsT>
|
template<typename...ArgsT>
|
||||||
@@ -390,6 +415,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Traversal ===========================================================================================================
|
// Traversal ===========================================================================================================
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#include <fennec/containers/sequence.h>
|
#include <fennec/containers/sequence.h>
|
||||||
#include <fennec/containers/sequence.h>
|
#include <fennec/containers/sequence.h>
|
||||||
#include <fennec/containers/sequence.h>
|
#include <fennec/containers/sequence.h>
|
||||||
#include <fennec/lang/compare.h>
|
#include <fennec/langcpp/compare.h>
|
||||||
#include <fennec/memory/allocator.h>
|
#include <fennec/memory/allocator.h>
|
||||||
|
|
||||||
// https://en.wikipedia.org/wiki/Red%E2%80%93black_tree
|
// https://en.wikipedia.org/wiki/Red%E2%80%93black_tree
|
||||||
|
|||||||
@@ -35,10 +35,10 @@
|
|||||||
|
|
||||||
#include <fennec/containers/optional.h>
|
#include <fennec/containers/optional.h>
|
||||||
#include <fennec/containers/set.h>
|
#include <fennec/containers/set.h>
|
||||||
#include <fennec/lang/compare.h>
|
#include <fennec/langcpp/compare.h>
|
||||||
#include <fennec/math/ext/primes.h>
|
#include <fennec/math/ext/primes.h>
|
||||||
#include <fennec/memory/allocator.h>
|
#include <fennec/memory/allocator.h>
|
||||||
#include <fennec/lang/hashing.h>
|
#include <fennec/langcpp/hashing.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -330,7 +330,7 @@ public:
|
|||||||
while (_alloc[i = (i + 1) % capacity()].value) {
|
while (_alloc[i = (i + 1) % capacity()].value) {
|
||||||
if (_alloc[i].psl == 0) break;
|
if (_alloc[i].psl == 0) break;
|
||||||
|
|
||||||
fennec::swap(_alloc[i - 1].value, _alloc[i].value);
|
fennec::swap(_alloc[p].value, _alloc[i].value);
|
||||||
--_alloc[p].psl, --_sumpsl;
|
--_alloc[p].psl, --_sumpsl;
|
||||||
p = i;
|
p = i;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#define FENNEC_CONTAINERS_TUPLE_H
|
#define FENNEC_CONTAINERS_TUPLE_H
|
||||||
|
|
||||||
#include <fennec/containers/detail/_tuple.h>
|
#include <fennec/containers/detail/_tuple.h>
|
||||||
#include <fennec/lang/type_sequences.h>
|
#include <fennec/langcpp/type_sequences.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -83,6 +83,8 @@ struct tuple : public detail::_tuple<make_index_sequence_t<sizeof...(TypesT)>, T
|
|||||||
template<size_t i>
|
template<size_t i>
|
||||||
using elem_t = typename nth_element<i, TypesT...>::type;
|
using elem_t = typename nth_element<i, TypesT...>::type;
|
||||||
|
|
||||||
|
static constexpr size_t size = sizeof...(TypesT);
|
||||||
|
|
||||||
template<typename...ArgsT>
|
template<typename...ArgsT>
|
||||||
tuple(ArgsT&&...args)
|
tuple(ArgsT&&...args)
|
||||||
: base_t(fennec::forward<ArgsT>(args)...) {
|
: base_t(fennec::forward<ArgsT>(args)...) {
|
||||||
|
|||||||
@@ -19,8 +19,10 @@
|
|||||||
#ifndef FENNEC_CORE_EVENT_H
|
#ifndef FENNEC_CORE_EVENT_H
|
||||||
#define FENNEC_CORE_EVENT_H
|
#define FENNEC_CORE_EVENT_H
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/lang/typed.h>
|
#include <fennec/rtti/enable.h>
|
||||||
|
|
||||||
|
#include <fennec/rtti/typeid.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -37,18 +39,8 @@ public:
|
|||||||
|
|
||||||
///
|
///
|
||||||
/// \brief Main event interface, includes static methods for registering listeners and dispatching events
|
/// \brief Main event interface, includes static methods for registering listeners and dispatching events
|
||||||
struct event : typed<event> {
|
struct event {
|
||||||
|
virtual ~event() = default;
|
||||||
// Delete default constructor to enforce type scheme
|
|
||||||
event() = delete;
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Event Constructor, stores the event type
|
|
||||||
/// \tparam EventT The type of the event
|
|
||||||
template<typename EventT>
|
|
||||||
event(EventT* type)
|
|
||||||
: typed(type) {
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \brief Registers a listener for the event type
|
/// \brief Registers a listener for the event type
|
||||||
@@ -67,6 +59,8 @@ struct event : typed<event> {
|
|||||||
static void add_listener(event_listener* listener, uint64_t type);
|
static void add_listener(event_listener* listener, uint64_t type);
|
||||||
static void remove_listener(event_listener* listener);
|
static void remove_listener(event_listener* listener);
|
||||||
static void dispatch(event* event);
|
static void dispatch(event* event);
|
||||||
|
|
||||||
|
FENNEC_RTTI_ENABLE();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#ifndef FENNEC_CORE_SYSTEM_H
|
#ifndef FENNEC_CORE_SYSTEM_H
|
||||||
#define FENNEC_CORE_SYSTEM_H
|
#define FENNEC_CORE_SYSTEM_H
|
||||||
#include <fennec/langproc/strings/string.h>
|
#include <fennec/lang/strings/string.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <fennec/containers/list.h>
|
#include <fennec/containers/list.h>
|
||||||
#include <fennec/containers/map.h>
|
#include <fennec/containers/map.h>
|
||||||
#include <fennec/containers/priority_queue.h>
|
#include <fennec/containers/priority_queue.h>
|
||||||
#include <fennec/langproc/strings/string.h>
|
#include <fennec/lang/strings/string.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// escape sequences are tricky, sometimes they must be separated by white space,
|
// escape sequences are tricky, sometimes they must be separated by white space,
|
||||||
@@ -19,11 +19,11 @@
|
|||||||
#ifndef FENNEC_LANGPROC_IO_FILE_H
|
#ifndef FENNEC_LANGPROC_IO_FILE_H
|
||||||
#define FENNEC_LANGPROC_IO_FILE_H
|
#define FENNEC_LANGPROC_IO_FILE_H
|
||||||
|
|
||||||
#include <fennec/langproc/filesystem/path.h>
|
#include <fennec/lang/filesystem/path.h>
|
||||||
|
|
||||||
#include <fennec/langproc/strings/cstring.h>
|
#include <fennec/lang/strings/cstring.h>
|
||||||
#include <fennec/langproc/strings/string.h>
|
#include <fennec/lang/strings/string.h>
|
||||||
#include <fennec/langproc/strings/wstring.h>
|
#include <fennec/lang/strings/wstring.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
#ifndef FENNEC_LANGPROC_IO_PATH_H
|
#ifndef FENNEC_LANGPROC_IO_PATH_H
|
||||||
#define FENNEC_LANGPROC_IO_PATH_H
|
#define FENNEC_LANGPROC_IO_PATH_H
|
||||||
|
|
||||||
#include <fennec/langproc/filesystem/path.h>
|
#include <fennec/lang/filesystem/path.h>
|
||||||
#include <fennec/langproc/strings/string.h>
|
#include <fennec/lang/strings/string.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
#ifndef FENNEC_LANGPROC_STRINGS_CSTRING_H
|
#ifndef FENNEC_LANGPROC_STRINGS_CSTRING_H
|
||||||
#define FENNEC_LANGPROC_STRINGS_CSTRING_H
|
#define FENNEC_LANGPROC_STRINGS_CSTRING_H
|
||||||
|
|
||||||
#include <fennec/langproc/strings/detail/_ctype.h>
|
#include <fennec/lang/strings/detail/_ctype.h>
|
||||||
#include <fennec/memory/detail/_string.h>
|
#include <fennec/memory/detail/_string.h>
|
||||||
|
|
||||||
#include <fennec/lang/assert.h>
|
#include <fennec/langcpp/assert.h>
|
||||||
|
|
||||||
#include <fennec/math/common.h>
|
#include <fennec/math/common.h>
|
||||||
#include <fennec/memory/bytes.h>
|
#include <fennec/memory/bytes.h>
|
||||||
@@ -31,8 +31,8 @@
|
|||||||
#ifndef FENNEC_LANGPROC_STRINGS_FORMAT_H
|
#ifndef FENNEC_LANGPROC_STRINGS_FORMAT_H
|
||||||
#define FENNEC_LANGPROC_STRINGS_FORMAT_H
|
#define FENNEC_LANGPROC_STRINGS_FORMAT_H
|
||||||
#include <fennec/containers/pair.h>
|
#include <fennec/containers/pair.h>
|
||||||
#include <fennec/langproc/strings/cstring.h>
|
#include <fennec/lang/strings/cstring.h>
|
||||||
#include <fennec/langproc/strings/string.h>
|
#include <fennec/lang/strings/string.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_LANGPROC_STRINGS_LOCALE_H
|
#ifndef FENNEC_LANGPROC_STRINGS_LOCALE_H
|
||||||
#define FENNEC_LANGPROC_STRINGS_LOCALE_H
|
#define FENNEC_LANGPROC_STRINGS_LOCALE_H
|
||||||
|
|
||||||
#include <fennec/langproc/strings/detail/_locale.h>
|
#include <fennec/lang/strings/detail/_locale.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
#ifndef FENNEC_LANGPROC_STRINGS_STRING_H
|
#ifndef FENNEC_LANGPROC_STRINGS_STRING_H
|
||||||
#define FENNEC_LANGPROC_STRINGS_STRING_H
|
#define FENNEC_LANGPROC_STRINGS_STRING_H
|
||||||
|
|
||||||
#include <fennec/langproc/strings/detail/_ctype.h>
|
#include <fennec/lang/strings/detail/_ctype.h>
|
||||||
#include <fennec/langproc/strings/cstring.h>
|
#include <fennec/lang/strings/cstring.h>
|
||||||
|
|
||||||
#include <fennec/lang/assert.h>
|
#include <fennec/langcpp/assert.h>
|
||||||
|
|
||||||
#include <fennec/memory/allocator.h>
|
#include <fennec/memory/allocator.h>
|
||||||
#include <fennec/memory/common.h>
|
#include <fennec/memory/common.h>
|
||||||
@@ -134,8 +134,14 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr _string& operator=(const _string& str) = default;
|
constexpr _string& operator=(const _string& str) {
|
||||||
constexpr _string& operator=(_string&& str) noexcept = default;
|
_str = str._str;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
constexpr _string& operator=(_string&& str) noexcept {
|
||||||
|
_str = fennec::move(str._str);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
// Properties ==========================================================================================================
|
// Properties ==========================================================================================================
|
||||||
|
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
#ifndef FENNEC_LANGPROC_STRINGS_wcstring_H
|
#ifndef FENNEC_LANGPROC_STRINGS_wcstring_H
|
||||||
#define FENNEC_LANGPROC_STRINGS_wcstring_H
|
#define FENNEC_LANGPROC_STRINGS_wcstring_H
|
||||||
|
|
||||||
#include <fennec/langproc/strings/detail/_ctype.h>
|
#include <fennec/lang/strings/detail/_ctype.h>
|
||||||
#include <fennec/memory/detail/_string.h>
|
#include <fennec/memory/detail/_string.h>
|
||||||
|
|
||||||
#include <fennec/lang/assert.h>
|
#include <fennec/langcpp/assert.h>
|
||||||
|
|
||||||
#include <fennec/math/common.h>
|
#include <fennec/math/common.h>
|
||||||
|
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
#ifndef FENNEC_LANGPROC_wstringS_WSTRING_H
|
#ifndef FENNEC_LANGPROC_wstringS_WSTRING_H
|
||||||
#define FENNEC_LANGPROC_wstringS_WSTRING_H
|
#define FENNEC_LANGPROC_wstringS_WSTRING_H
|
||||||
|
|
||||||
#include <fennec/langproc/strings/detail/_ctype.h>
|
#include <fennec/lang/strings/detail/_ctype.h>
|
||||||
#include <fennec/langproc/strings/wcstring.h>
|
#include <fennec/lang/strings/wcstring.h>
|
||||||
|
|
||||||
#include <fennec/lang/assert.h>
|
#include <fennec/langcpp/assert.h>
|
||||||
|
|
||||||
#include <fennec/memory/allocator.h>
|
#include <fennec/memory/allocator.h>
|
||||||
#include <fennec/memory/common.h>
|
#include <fennec/memory/common.h>
|
||||||
@@ -1,495 +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 type_traits.h
|
|
||||||
/// \brief \ref fennec_lang_type_traits
|
|
||||||
///
|
|
||||||
///
|
|
||||||
/// \details
|
|
||||||
/// \author Medusa Slockbower
|
|
||||||
///
|
|
||||||
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
|
||||||
///
|
|
||||||
///
|
|
||||||
|
|
||||||
#ifndef 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_type_traits">
|
|
||||||
/// <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
|
|
||||||
///
|
|
||||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
|
||||||
/// \ref fennec::is_convertible "is_convertible<TypeT0, TypeT1>::value"<br>
|
|
||||||
/// \ref fennec::is_convertible_v "is_convertible_v<TypeT>"
|
|
||||||
/// <td width="50%" style="vertical-align: top">
|
|
||||||
/// \copydetails fennec::is_convertible
|
|
||||||
///
|
|
||||||
/// <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>
|
|
||||||
///
|
|
||||||
|
|
||||||
#include <fennec/lang/intrinsics.h>
|
|
||||||
#include <fennec/lang/type_transforms.h>
|
|
||||||
#include <fennec/lang/detail/_type_traits.h>
|
|
||||||
|
|
||||||
namespace fennec
|
|
||||||
{
|
|
||||||
|
|
||||||
// fennec::declval =====================================================================================================
|
|
||||||
|
|
||||||
template<typename T> auto declval() noexcept -> decltype(detail::_declval<T>(0)) {
|
|
||||||
static_assert(detail::_declval_protector<T>{}, "declval must not be used");
|
|
||||||
return detail::_declval<T>(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr inline bool is_constant_evaluated() noexcept {
|
|
||||||
if consteval {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// fennec::is_void =====================================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief check if \p T is of type void
|
|
||||||
///
|
|
||||||
/// \details Stores a boolean value in `is_void::value`, representing whether the provided type is of base type void.
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> struct is_void
|
|
||||||
: detail::_is_void<remove_cvr_t<T>>{};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief shorthand for ```is_void<T>::value```
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> constexpr bool_t is_void_v = is_void<T>::value;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// fennec::is_bool =====================================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief check if \p T is of type bool
|
|
||||||
///
|
|
||||||
/// \details Stores a boolean value in `is_bool::value`, representing whether the provided type is of base type bool.
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> struct is_bool
|
|
||||||
: detail::_is_bool<remove_cvr_t<T>>{};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief shorthand for ```is_bool<T>::value```
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> constexpr bool_t is_bool_v = is_bool<T>::value;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// fennec::is_null_pointer =============================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief check if \p T is of type nullptr_t
|
|
||||||
///
|
|
||||||
/// \details Stores a boolean value in `is_null_pointer::value`, representing whether the provided type is of base type nullptr_t.
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> struct is_null_pointer
|
|
||||||
: detail::_is_null_pointer<remove_cvr_t<T>>{};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief shorthand for ```is_null_pointer<T>::value```
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> constexpr bool_t is_null_pointer_v = is_null_pointer<T>::value;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// fennec::is_array ====================================================================================================
|
|
||||||
|
|
||||||
#ifdef FENNEC_BUILTIN_IS_ARRAY
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief check if \p T is of an array type
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> struct is_array
|
|
||||||
: bool_constant<FENNEC_BUILTIN_IS_ARRAY(T)> {};
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief check if \p T is of an array type
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> struct is_array
|
|
||||||
: false_type {};
|
|
||||||
|
|
||||||
// overload for a sized array type
|
|
||||||
template<typename T, size_t N> struct is_array<T[N]>
|
|
||||||
: true_type {};
|
|
||||||
|
|
||||||
// overload for a generic array type
|
|
||||||
template<typename T> struct is_array<T[]>
|
|
||||||
: true_type {};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief shorthand for ```is_array<T>::value```
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> constexpr bool_t is_array_v = is_array<T>::value;
|
|
||||||
|
|
||||||
// fennec::is_class ====================================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief check if \p T is a class
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> struct is_class
|
|
||||||
: bool_constant<FENNEC_BUILTIN_IS_CLASS(T)> {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief check if \p T is a class
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> constexpr size_t is_class_v = is_class<T>::value;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Integral Types ======================================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief check if \p T is of an integral
|
|
||||||
///
|
|
||||||
/// \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
|
|
||||||
template<typename T> struct is_integral
|
|
||||||
: detail::_is_integral<remove_cvr_t<T>> {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief shorthand for ```is_integral<T>::value```
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> constexpr bool_t is_integral_v = is_integral<T>::value;
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \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`.
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> struct is_signed
|
|
||||||
: detail::_is_signed<remove_cvr_t<T>> {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief shorthand for ```is_signed<T>::value```
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> constexpr bool_t is_signed_v = is_signed<T>::value;
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \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`.
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> struct is_unsigned
|
|
||||||
: detail::_is_unsigned<remove_cvr_t<T>> {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief shorthand for ```is_unsigned<T>::value```
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> constexpr bool_t is_unsigned_v = is_unsigned<T>::value;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Floating Point Types ================================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief check if \p T is of a floating point type
|
|
||||||
///
|
|
||||||
/// \details Checks if type `T` is a floating point type and store it in `is_same::value`.
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> struct is_floating_point
|
|
||||||
: detail::_is_floating_point<remove_cvr_t<T>>{};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief shorthand for ```is_floating_point<T>::value```
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> constexpr bool_t is_floating_point_v = is_floating_point<T> {};
|
|
||||||
|
|
||||||
|
|
||||||
// Pointer Types =======================================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief check if \p T is of a floating point type
|
|
||||||
///
|
|
||||||
/// \details Checks if type `T` is a floating point type and store it in `is_same::value`.
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> struct is_pointer
|
|
||||||
: detail::_is_pointer<remove_cvr_t<T>>{};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief shorthand for ```is_floating_point<T>::value```
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> constexpr bool_t is_pointer_v = is_pointer<T> {};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Arithmetic Types ====================================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \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`.
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> struct is_arithmetic
|
|
||||||
: bool_constant<is_integral_v<T> or is_floating_point_v<T>>{};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief shorthand for ```is_arithmetic<T>::value```
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> constexpr bool_t is_arithmetic_v = is_arithmetic<T>::value;
|
|
||||||
|
|
||||||
|
|
||||||
// fennec::is_fundamental ==============================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief check if \p T is a fundamental type, i.e. arithmetic, void, or nullptr_t
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> struct is_fundamental
|
|
||||||
: bool_constant<is_arithmetic_v<T> || is_void_v<T> || is_null_pointer_v<T>>{};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief shorthand for ```is_fundamental<T>::value```
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T> constexpr bool_t is_fundamental_v = is_fundamental<T>::value;
|
|
||||||
|
|
||||||
|
|
||||||
// fennec::is_same =====================================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \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
|
|
||||||
template<typename T0, typename T1> struct is_same : false_type {};
|
|
||||||
|
|
||||||
// true case
|
|
||||||
template<typename T> struct is_same<T, T> : true_type {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief shorthand for ```is_same<T0, T1>::value```
|
|
||||||
/// \tparam T type to check
|
|
||||||
template<typename T0, typename T1> constexpr bool_t is_same_v = is_same<T0, T1> {};
|
|
||||||
|
|
||||||
// fennec::is_convertible ==============================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \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)> {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief shorthand for `can_convert<TypeT0, TypeT1>::value`
|
|
||||||
/// \param FromT First type
|
|
||||||
/// \param ToT Second type
|
|
||||||
template<typename FromT, typename ToT> constexpr bool_t is_convertible_v = is_convertible<FromT, ToT>{};
|
|
||||||
|
|
||||||
|
|
||||||
// fennec::is_constructible ============================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Check if `ClassT` can be constructed with `ArgsT,` i.e. `ClassT(ArgsT...)`.
|
|
||||||
/// This may be read as "is `ClassT` constructible with `ArgsT`"
|
|
||||||
/// \tparam ClassT The class type to test
|
|
||||||
/// \tparam ArgsT The arguments for the specific constructor
|
|
||||||
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...>{};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Check if `ClassT` is default constructible
|
|
||||||
/// \tparam ClassT The class type to test
|
|
||||||
template<typename ClassT> struct is_default_constructible
|
|
||||||
: bool_constant<FENNEC_BUILTIN_IS_CONSTRUCTIBLE(ClassT,)> {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Shorthand for `is_default_constructible<ClassT>::value`
|
|
||||||
template<typename ClassT, typename...ArgsT> constexpr bool_t is_default_constructible_v = is_default_constructible<ClassT>{};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Check if `ClassT` is copy constructible
|
|
||||||
/// \tparam ClassT The class type to test
|
|
||||||
template<typename ClassT> struct is_copy_constructible
|
|
||||||
: bool_constant<FENNEC_BUILTIN_IS_CONSTRUCTIBLE(ClassT, add_lvalue_reference_t<const ClassT>)> {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Shorthand for `is_copy_constructible<ClassT>::value`
|
|
||||||
template<typename ClassT, typename...ArgsT> constexpr bool_t is_copy_constructible_v = is_copy_constructible<ClassT>{};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Check if `ClassT` is copy constructible
|
|
||||||
/// \tparam ClassT The class type to test
|
|
||||||
template<typename ClassT> struct is_move_constructible
|
|
||||||
: bool_constant<FENNEC_BUILTIN_IS_CONSTRUCTIBLE(ClassT, add_rvalue_reference_t<ClassT>)> {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Shorthand for `is_copy_constructible<ClassT>::value`
|
|
||||||
template<typename ClassT, typename...ArgsT> constexpr bool_t is_move_constructible_v = is_move_constructible<ClassT>{};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Check if `ClassT` is trivially constructible
|
|
||||||
/// \tparam ClassT The class type to test
|
|
||||||
template<typename ClassT> struct is_trivially_constructible
|
|
||||||
: bool_constant<FENNEC_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE(ClassT)> {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Shorthand for `is_trivially_constructible<ClassT, ArgsT...>::value`
|
|
||||||
template<typename ClassT> constexpr bool_t is_trivially_constructible_v = is_trivially_constructible<ClassT>{};
|
|
||||||
|
|
||||||
|
|
||||||
// fennec::is_trivially_destructible ===================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Check if `ClassT` is trivially destructible
|
|
||||||
/// \tparam ClassT The class type to test
|
|
||||||
template<typename ClassT> struct is_trivially_destructible
|
|
||||||
: bool_constant<FENNEC_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE(ClassT)> {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Shorthand for `is_trivially_destructible<ClassT, ArgsT...>::value`
|
|
||||||
template<typename ClassT> constexpr bool_t is_trivially_destructible_v = is_trivially_destructible<ClassT>{};
|
|
||||||
|
|
||||||
|
|
||||||
// fennec::is_assignable ===============================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Check if `ClassT` can be constructed with `ArgsT,` i.e. `ClassT(ArgsT...)`.
|
|
||||||
/// This may be read as "is `ClassT` constructible with `ArgsT`"
|
|
||||||
/// \tparam ClassAT The class type to test
|
|
||||||
/// \tparam ClassBT The arguments for the specific constructor
|
|
||||||
template<typename ClassAT, typename ClassBT> struct is_assignable
|
|
||||||
: bool_constant<FENNEC_BUILTIN_IS_ASSIGNABLE(ClassAT, ClassBT)> {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Shorthand for `is_constructible<ClassT, ArgsT...>::value`
|
|
||||||
template<typename ClassT, typename...ArgsT> constexpr bool_t is_assignable_v = is_assignable<ClassT, ArgsT...>{};
|
|
||||||
|
|
||||||
|
|
||||||
// fennec::is_copy_assignable ==========================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Check if `ClassT` is copy assignable
|
|
||||||
/// \tparam ClassT The class type to test
|
|
||||||
template<typename ClassT> struct is_copy_assignable
|
|
||||||
: bool_constant<FENNEC_BUILTIN_IS_ASSIGNABLE(add_lvalue_reference_t<ClassT>, add_lvalue_reference_t<const ClassT>)> {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Shorthand for `is_copy_assignable<ClassT>::value`
|
|
||||||
template<typename ClassT> constexpr bool_t is_copy_assignable_v = is_copy_assignable<ClassT>{};
|
|
||||||
|
|
||||||
|
|
||||||
// fennec::is_move_assignable ==========================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Check if `ClassT` is move assignable
|
|
||||||
/// \tparam ClassT The class type to test
|
|
||||||
template<typename ClassT> struct is_move_assignable
|
|
||||||
: bool_constant<FENNEC_BUILTIN_IS_ASSIGNABLE(add_lvalue_reference_t<ClassT>, add_rvalue_reference_t<ClassT>)> {};
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Shorthand for `is_move_assignable<ClassT>::value`
|
|
||||||
template<typename ClassT> constexpr bool_t is_move_assignable_v = is_move_assignable<ClassT>{};
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // FENNEC_LANG_TYPE_TRAITS_H
|
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
///
|
///
|
||||||
/// \page fennec_lang_assert Assertions
|
/// \page fennec_lang_assert Assertions
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/lang/assert.h> \endcode
|
/// \code #include <fennec/langcpp/assert.h> \endcode
|
||||||
///
|
///
|
||||||
/// This header contains macros for making assertions about code behaviour.
|
/// This header contains macros for making assertions about code behaviour.
|
||||||
///
|
///
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
///
|
///
|
||||||
/// \page fennec_lang_bit_manipulation Bit Manipulation
|
/// \page fennec_lang_bit_manipulation Bit Manipulation
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/lang/bits.h> \endcode
|
/// \code #include <fennec/langcpp/bits.h> \endcode
|
||||||
///
|
///
|
||||||
/// This header contains definitions for manipulating the bits of a provided object or pointer.
|
/// This header contains definitions for manipulating the bits of a provided object or pointer.
|
||||||
///
|
///
|
||||||
@@ -79,9 +79,9 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/lang/intrinsics.h>
|
#include <fennec/langcpp/intrinsics.h>
|
||||||
#include <fennec/memory/common.h>
|
#include <fennec/memory/common.h>
|
||||||
#include <fennec/lang/detail/_bits.h>
|
#include <fennec/langcpp/detail/_bits.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_LANG_COMPARE_H
|
#ifndef FENNEC_LANG_COMPARE_H
|
||||||
#define FENNEC_LANG_COMPARE_H
|
#define FENNEC_LANG_COMPARE_H
|
||||||
|
|
||||||
#include <fennec/lang/type_operators.h>
|
#include <fennec/langcpp/type_operators.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -32,12 +32,12 @@
|
|||||||
#ifndef FENNEC_LANG_CONDITIONAL_TYPES_H
|
#ifndef FENNEC_LANG_CONDITIONAL_TYPES_H
|
||||||
#define FENNEC_LANG_CONDITIONAL_TYPES_H
|
#define FENNEC_LANG_CONDITIONAL_TYPES_H
|
||||||
|
|
||||||
#include <fennec/lang/type_identity.h>
|
#include <fennec/langcpp/type_identity.h>
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \page fennec_lang_conditional_types Conditional Types
|
/// \page fennec_lang_conditional_types Conditional Types
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/lang/conditional_types.h> \endcode
|
/// \code #include <fennec/langcpp/conditional_types.h> \endcode
|
||||||
///
|
///
|
||||||
/// This header contains various compile-time functions for conditionally setting types, detecting types, or
|
/// This header contains various compile-time functions for conditionally setting types, detecting types, or
|
||||||
/// conditionally enabling functions. <br><br>
|
/// conditionally enabling functions. <br><br>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
///
|
///
|
||||||
/// \brief This header is part of the metaprogramming library. It defines structures for sequences of values, used during compile time.
|
/// \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
|
/// \code #include <fennec/langcpp/sequences.h> \endcode
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_sequences">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_sequences">
|
||||||
/// <tr><th style="vertical-align: top">Syntax
|
/// <tr><th style="vertical-align: top">Syntax
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
/// </table>
|
/// </table>
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/lang/type_traits.h>
|
#include <fennec/langcpp/type_traits.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
#ifndef FENNEC_LANG_CONSTANTS_H
|
#ifndef FENNEC_LANG_CONSTANTS_H
|
||||||
#define FENNEC_LANG_CONSTANTS_H
|
#define FENNEC_LANG_CONSTANTS_H
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
|
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
/// \brief This header is part of the metaprogramming library. It defines structures for constant values,
|
/// \brief This header is part of the metaprogramming library. It defines structures for constant values,
|
||||||
/// used during compile time.
|
/// used during compile time.
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/lang/constants.h> \endcode
|
/// \code #include <fennec/langcpp/constants.h> \endcode
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_constants">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_constants">
|
||||||
/// <tr><th style="vertical-align: top">Syntax
|
/// <tr><th style="vertical-align: top">Syntax
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_LANG_DETAIL_BITS_H
|
#ifndef FENNEC_LANG_DETAIL_BITS_H
|
||||||
#define FENNEC_LANG_DETAIL_BITS_H
|
#define FENNEC_LANG_DETAIL_BITS_H
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
#ifndef FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H
|
#ifndef FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H
|
||||||
#define FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H
|
#define FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/lang/type_transforms.h>
|
#include <fennec/langcpp/type_transforms.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_LANG_DETAIL_TYPE_SEQUENCES_H
|
#ifndef FENNEC_LANG_DETAIL_TYPE_SEQUENCES_H
|
||||||
#define FENNEC_LANG_DETAIL_TYPE_SEQUENCES_H
|
#define FENNEC_LANG_DETAIL_TYPE_SEQUENCES_H
|
||||||
|
|
||||||
#include <fennec/lang/type_transforms.h>
|
#include <fennec/langcpp/type_transforms.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
@@ -19,8 +19,7 @@
|
|||||||
#ifndef FENNEC_LANG_DETAIL_TYPE_TRAITS_H
|
#ifndef FENNEC_LANG_DETAIL_TYPE_TRAITS_H
|
||||||
#define FENNEC_LANG_DETAIL_TYPE_TRAITS_H
|
#define FENNEC_LANG_DETAIL_TYPE_TRAITS_H
|
||||||
|
|
||||||
#include <fennec/lang/constants.h>
|
#include <fennec/langcpp/constants.h>
|
||||||
#include <fennec/lang/float.h>
|
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
@@ -70,6 +69,27 @@ namespace fennec::detail
|
|||||||
|
|
||||||
template<typename T> struct _declval_protector : bool_constant<false> {};
|
template<typename T> struct _declval_protector : bool_constant<false> {};
|
||||||
|
|
||||||
|
template<typename T> struct _is_complete {
|
||||||
|
template<typename U>
|
||||||
|
static auto test(U*) -> bool_constant<sizeof(U) == sizeof(U)>;
|
||||||
|
static auto test(...) -> false_type;
|
||||||
|
using type = decltype(_is_complete::test(static_cast<T*>(nullptr)));
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T> struct _is_destructible {
|
||||||
|
template<typename U, typename = decltype(_declval<T&>().~T())>
|
||||||
|
static auto test(int) -> true_type;
|
||||||
|
static auto test(...) -> false_type;
|
||||||
|
using type = decltype(test<T>(0));
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T> struct _is_nothrow_destructible {
|
||||||
|
template<typename U, typename = decltype(noexcept(_declval<T&>().~T()))>
|
||||||
|
static auto test(int) -> true_type;
|
||||||
|
static auto test(...) -> false_type;
|
||||||
|
using type = decltype(test<T>(0));
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FENNEC_LANG_DETAIL_TYPE_TRAITS_H
|
#endif // FENNEC_LANG_DETAIL_TYPE_TRAITS_H
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_LANG_DETAIL_TYPE_TRANSFORMS_H
|
#ifndef FENNEC_LANG_DETAIL_TYPE_TRANSFORMS_H
|
||||||
#define FENNEC_LANG_DETAIL_TYPE_TRANSFORMS_H
|
#define FENNEC_LANG_DETAIL_TYPE_TRANSFORMS_H
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
#ifndef FENNEC_LANG_FLOAT_H
|
#ifndef FENNEC_LANG_FLOAT_H
|
||||||
#define FENNEC_LANG_FLOAT_H
|
#define FENNEC_LANG_FLOAT_H
|
||||||
|
|
||||||
#include <fennec/lang/bits.h>
|
#include <fennec/langcpp/bits.h>
|
||||||
|
|
||||||
#undef FLT_HAS_INFINITY
|
#undef FLT_HAS_INFINITY
|
||||||
#undef FLT_HAS_QUIET_NAN
|
#undef FLT_HAS_QUIET_NAN
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
#ifndef FENNEC_LANG_HASHING_H
|
#ifndef FENNEC_LANG_HASHING_H
|
||||||
#define FENNEC_LANG_HASHING_H
|
#define FENNEC_LANG_HASHING_H
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/lang/type_traits.h>
|
#include <fennec/langcpp/type_traits.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
/// \brief This header contains definitions for compiler intrinsics necessary for implementing functions of the
|
/// \brief This header contains definitions for compiler intrinsics necessary for implementing functions of the
|
||||||
/// C++ stdlib.
|
/// C++ stdlib.
|
||||||
///
|
///
|
||||||
/// \code{.cpp}#include <fennec/lang/intrinsics.h>\endcode
|
/// \code{.cpp}#include <fennec/langcpp/intrinsics.h>\endcode
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_intrinsics">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_intrinsics">
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
// =====================================================================================================================
|
// =====================================================================================================================
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \file lang.h
|
/// \file langcpp.h
|
||||||
/// \brief \ref fennec_lang
|
/// \brief \ref fennec_lang
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
@@ -31,10 +31,10 @@
|
|||||||
#ifndef FENNEC_LANG_H
|
#ifndef FENNEC_LANG_H
|
||||||
#define FENNEC_LANG_H
|
#define FENNEC_LANG_H
|
||||||
|
|
||||||
#include <fennec/lang/assert.h>
|
#include <fennec/langcpp/assert.h>
|
||||||
#include <fennec/lang/bits.h>
|
#include <fennec/langcpp/bits.h>
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/lang/utility.h>
|
#include <fennec/langcpp/utility.h>
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \page fennec_lang C++ Language Library
|
/// \page fennec_lang C++ Language Library
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
/// floats and integers. There are overloads for all builtin types, and overloads for other types are included in
|
/// floats and integers. There are overloads for all builtin types, and overloads for other types are included in
|
||||||
/// their own header.
|
/// their own header.
|
||||||
///
|
///
|
||||||
/// \code{.cpp}#include <fennec/lang/limits.h>\endcode
|
/// \code{.cpp}#include <fennec/langcpp/limits.h>\endcode
|
||||||
///
|
///
|
||||||
/// \section fennec_lang_limits_numeric_limits Numeric Limits
|
/// \section fennec_lang_limits_numeric_limits Numeric Limits
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_limits">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_limits">
|
||||||
@@ -197,11 +197,11 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/lang/type_traits.h>
|
#include <fennec/langcpp/type_traits.h>
|
||||||
|
|
||||||
#include <fennec/lang/integer.h>
|
#include <fennec/langcpp/integer.h>
|
||||||
#include <fennec/lang/float.h>
|
#include <fennec/langcpp/float.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
///
|
///
|
||||||
/// \page fennec_lang_numeric_transforms Numeric Transforms
|
/// \page fennec_lang_numeric_transforms Numeric Transforms
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/lang/numeric_transforms.h> \endcode
|
/// \code #include <fennec/langcpp/numeric_transforms.h> \endcode
|
||||||
///
|
///
|
||||||
/// This header contains various compile-time functions for changing the characteristics of a provided type
|
/// This header contains various compile-time functions for changing the characteristics of a provided type
|
||||||
///
|
///
|
||||||
@@ -54,8 +54,8 @@
|
|||||||
///
|
///
|
||||||
/// </table>
|
/// </table>
|
||||||
|
|
||||||
#include <fennec/lang/type_transforms.h>
|
#include <fennec/langcpp/type_transforms.h>
|
||||||
#include <fennec/lang/detail/_numeric_transforms.h>
|
#include <fennec/langcpp/detail/_numeric_transforms.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
/// \brief Part of the fennec metaprogramming library. This header defines structures for copying types with different traits
|
/// \brief Part of the fennec metaprogramming library. This header defines structures for copying types with different traits
|
||||||
/// or rather, transform them, at compile time.
|
/// or rather, transform them, at compile time.
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/lang/type_identity.h> \endcode
|
/// \code #include <fennec/langcpp/type_identity.h> \endcode
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_identity">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_identity">
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
///
|
///
|
||||||
/// \brief This header is part of the metaprogramming library. It defines structures for sequences of types, used during compile time.
|
/// \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
|
/// \code #include <fennec/langcpp/type_sequences.h> \endcode
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_sequences">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_sequences">
|
||||||
/// <tr><th style="vertical-align: top">Syntax
|
/// <tr><th style="vertical-align: top">Syntax
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
/// </table>
|
/// </table>
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/lang/detail/_type_sequences.h>
|
#include <fennec/langcpp/detail/_type_sequences.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
854
include/fennec/langcpp/type_traits.h
Normal file
854
include/fennec/langcpp/type_traits.h
Normal file
@@ -0,0 +1,854 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// 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 type_traits.h
|
||||||
|
/// \brief \ref fennec_lang_type_traits
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \details
|
||||||
|
/// \author Medusa Slockbower
|
||||||
|
///
|
||||||
|
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
#ifndef 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/langcpp/type_traits.h> \endcode
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \section Primary Type Categories
|
||||||
|
///
|
||||||
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_traits_primary_categories">
|
||||||
|
/// <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_null_pointer "is_null_pointer<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_null_pointer_v "is_null_pointer_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_null_pointer
|
||||||
|
///
|
||||||
|
/// <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_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_array "is_array<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_array_v "is_array_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_array
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_enum "is_enum<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_enum_v "is_enum_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_enum
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_union "is_union<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_union_v "is_union_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_union
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_class "is_class<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_class_v "is_class_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_class
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_function "is_function<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_function_v "is_function_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_function
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_pointer "is_pointer<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_pointer_v "is_pointer_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_pointer
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_lvalue_reference "is_lvalue_reference<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_lvalue_reference_v "is_lvalue_reference_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_lvalue_reference
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_rvalue_reference "is_rvalue_reference<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_rvalue_reference_v "is_rvalue_reference_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_rvalue_reference
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_member_object_pointer "is_member_object_pointer<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_member_object_pointer_v "is_member_object_pointer_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_member_object_pointer
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_member_function_pointer "is_member_function_pointer<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_member_function_pointer_v "is_member_function_pointer_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_member_function_pointer
|
||||||
|
///
|
||||||
|
/// </table>
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \section Composite Type Categories
|
||||||
|
///
|
||||||
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_traits_composite_categories">
|
||||||
|
/// <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_fundamental "is_fundamental<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_fundamental_v "is_fundamental_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_fundamental
|
||||||
|
///
|
||||||
|
/// <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_scalar "is_scalar<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_scalar_v "is_scalar_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_scalar
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_object "is_object<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_object_v "is_object_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_object
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_compound "is_compound<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_compound_v "is_compound_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_compound
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_reference "is_reference<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_reference_v "is_reference_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_reference
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_member_pointer "is_member_pointer<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_member_pointer_v "is_member_pointer_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_member_pointer
|
||||||
|
///
|
||||||
|
/// </table>
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \section Type Properties
|
||||||
|
///
|
||||||
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_traits_type_properties">
|
||||||
|
/// <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_const "is_const<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_const_v "is_const_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_const
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_volatile "is_volatile<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_volatile_v "is_volatile_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_volatile
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_trivial "is_trivial<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_trivial_v "is_trivial_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_trivial
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_trivially_copyable "is_trivially_copyable<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_trivially_copyable_v "is_trivially_copyable_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_trivially_copyable
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_standard_layout "is_standard_layout<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_standard_layout_v "is_standard_layout_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_standard_layout
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::has_unique_object_representations "has_unique_object_representations<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::has_unique_object_representations_v "has_unique_object_representations_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::has_unique_object_representations
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_empty "is_empty<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_empty_v "is_empty_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_empty
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_polymorphic "is_polymorphic<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_polymorphic_v "is_polymorphic_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_polymorphic
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_abstract "is_abstract<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_abstract_v "is_abstract_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_abstract
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_complete "is_complete<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_complete_v "is_complete_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_complete
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_final "is_final<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_final_v "is_final_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_final
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_aggregate "is_aggregate<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_aggregate_v "is_aggregate_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_aggregate
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_implicit_lifetime "is_implicit_lifetime<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_implicit_lifetime_v "is_implicit_lifetime_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_implicit_lifetime
|
||||||
|
///
|
||||||
|
/// <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_bounded_array "is_bounded_array<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_bounded_array_v "is_bounded_array_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_bounded_array
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_unbounded_array "is_unbounded_array<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_unbounded_array_v "is_unbounded_array_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_unbounded_array
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_scoped_enum "is_scoped_enum<TypeT>::value"<br>
|
||||||
|
/// \ref fennec::is_scoped_enum_v "is_scoped_enum_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_scoped_enum
|
||||||
|
///
|
||||||
|
/// </table>
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \section Supported Operations
|
||||||
|
///
|
||||||
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_traits_supported_operations">
|
||||||
|
/// <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_convertible "is_convertible<TypeT0, TypeT1>::value"<br>
|
||||||
|
/// \ref fennec::is_convertible_v "is_convertible_v<TypeT>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_convertible
|
||||||
|
///
|
||||||
|
/// <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...>"
|
||||||
|
/// \ref fennec::is_trivially_constructible "is_trivially_constructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_trivially_constructible_v "is_trivially_constructible_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_nothrow_constructible "is_nothrow_constructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_nothrow_constructible_v "is_nothrow_constructible_v<ClassT, ArgsT...>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_constructible
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_default_constructible "is_default_constructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_default_constructible_v "is_default_constructible_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_trivially_default_constructible "is_trivially_default_constructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_trivially_default_constructible_v "is_trivially_default_constructible_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_nothrow_default_constructible "is_nothrow_default_constructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_nothrow_default_constructible_v "is_nothrow_default_constructible_v<ClassT, ArgsT...>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_default_constructible
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_copy_constructible "is_copy_constructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_copy_constructible_v "is_copy_constructible_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_trivially_copy_constructible "is_trivially_copy_constructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_trivially_copy_constructible_v "is_trivially_copy_constructible_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_nothrow_copy_constructible "is_nothrow_copy_constructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_nothrow_copy_constructible_v "is_nothrow_copy_constructible_v<ClassT, ArgsT...>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_copy_constructible
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_move_constructible "is_move_constructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_move_constructible_v "is_move_constructible_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_trivially_move_constructible "is_trivially_move_constructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_trivially_move_constructible_v "is_trivially_move_constructible_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_nothrow_move_constructible "is_nothrow_move_constructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_nothrow_move_constructible_v "is_nothrow_move_constructible_v<ClassT, ArgsT...>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \movedetails fennec::is_move_constructible
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_assignable "is_assignable<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_assignable_v "is_assignable_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_trivially_assignable "is_trivially_assignable<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_trivially_assignable_v "is_trivially_assignable_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_nothrow_assignable "is_nothrow_assignable<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_nothrow_assignable_v "is_nothrow_assignable_v<ClassT, ArgsT...>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_assignable
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_copy_assignable "is_copy_assignable<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_copy_assignable_v "is_copy_assignable_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_trivially_copy_assignable "is_trivially_copy_assignable<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_trivially_copy_assignable_v "is_trivially_copy_assignable_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_nothrow_copy_assignable "is_nothrow_copy_assignable<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_nothrow_copy_assignable_v "is_nothrow_copy_assignable_v<ClassT, ArgsT...>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_copy_assignable
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_move_assignable "is_move_assignable<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_move_assignable_v "is_move_assignable_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_trivially_move_assignable "is_trivially_move_assignable<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_trivially_move_assignable_v "is_trivially_move_assignable_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_nothrow_move_assignable "is_nothrow_move_assignable<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_nothrow_move_assignable_v "is_nothrow_move_assignable_v<ClassT, ArgsT...>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \movedetails fennec::is_move_assignable
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::is_destructible "is_destructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_destructible_v "is_destructible_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_trivially_destructible "is_trivially_destructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_trivially_destructible_v "is_trivially_destructible_v<ClassT, ArgsT...>"
|
||||||
|
/// \ref fennec::is_nothrow_destructible "is_nothrow_destructible<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::is_nothrow_destructible_v "is_nothrow_destructible_v<ClassT, ArgsT...>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::is_destructible
|
||||||
|
///
|
||||||
|
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||||
|
/// \ref fennec::has_virtual_destructor "has_virtual_destructor<ClassT, ArgsT...>::value"<br>
|
||||||
|
/// \ref fennec::has_virtual_destructor_v "has_virtual_destructor_v<ClassT, ArgsT...>"
|
||||||
|
/// <td width="50%" style="vertical-align: top">
|
||||||
|
/// \copydetails fennec::has_virtual_destructor
|
||||||
|
///
|
||||||
|
/// </table>
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \section Type Relationships
|
||||||
|
///
|
||||||
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_traits_type_relationships">
|
||||||
|
/// <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_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/langcpp/intrinsics.h>
|
||||||
|
#include <fennec/langcpp/type_transforms.h>
|
||||||
|
#include <fennec/langcpp/detail/_type_traits.h>
|
||||||
|
|
||||||
|
namespace fennec
|
||||||
|
{
|
||||||
|
|
||||||
|
// fennec::declval =====================================================================================================
|
||||||
|
|
||||||
|
template<typename T> auto declval() noexcept -> decltype(detail::_declval<T>(0)) {
|
||||||
|
static_assert(detail::_declval_protector<T>{}, "declval must not be used");
|
||||||
|
return detail::_declval<T>(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr inline bool is_constant_evaluated() noexcept {
|
||||||
|
if consteval {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// fennec::is_void =====================================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief check if \p T is of type void
|
||||||
|
///
|
||||||
|
/// \details Stores a boolean value in `is_void::value`, representing whether the provided type is of base type void.
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> struct is_void
|
||||||
|
: detail::_is_void<remove_cvr_t<T>>{};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for ```is_void<T>::value```
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> constexpr bool_t is_void_v = is_void<T>::value;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// fennec::is_null_pointer =============================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief check if \p T is of type nullptr_t
|
||||||
|
///
|
||||||
|
/// \details Stores a boolean value in `is_null_pointer::value`, representing whether the provided type is of base type nullptr_t.
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> struct is_null_pointer
|
||||||
|
: detail::_is_null_pointer<remove_cvr_t<T>>{};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for ```is_null_pointer<T>::value```
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> constexpr bool_t is_null_pointer_v = is_null_pointer<T>::value;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// fennec::is_array ====================================================================================================
|
||||||
|
|
||||||
|
#ifdef FENNEC_BUILTIN_IS_ARRAY
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief check if \p T is of an array type
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> struct is_array
|
||||||
|
: bool_constant<FENNEC_BUILTIN_IS_ARRAY(T)> {};
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief check if \p T is of an array type
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> struct is_array
|
||||||
|
: false_type {};
|
||||||
|
|
||||||
|
// overload for a sized array type
|
||||||
|
template<typename T, size_t N> struct is_array<T[N]>
|
||||||
|
: true_type {};
|
||||||
|
|
||||||
|
// overload for a generic array type
|
||||||
|
template<typename T> struct is_array<T[]>
|
||||||
|
: true_type {};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for ```is_array<T>::value```
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> constexpr bool_t is_array_v = is_array<T>::value;
|
||||||
|
|
||||||
|
// fennec::is_class ====================================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief check if \p T is a class
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> struct is_class
|
||||||
|
: bool_constant<FENNEC_BUILTIN_IS_CLASS(T)> {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief check if \p T is a class
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> constexpr size_t is_class_v = is_class<T>::value;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Integral Types ======================================================================================================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// fennec::is_bool =====================================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief check if \p T is of type bool
|
||||||
|
///
|
||||||
|
/// \details Stores a boolean value in `is_bool::value`, representing whether the provided type is of base type bool.
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> struct is_bool
|
||||||
|
: detail::_is_bool<remove_cvr_t<T>>{};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for ```is_bool<T>::value```
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> constexpr bool_t is_bool_v = is_bool<T>::value;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief check if \p T is of an integral
|
||||||
|
///
|
||||||
|
/// \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
|
||||||
|
template<typename T> struct is_integral
|
||||||
|
: detail::_is_integral<remove_cvr_t<T>> {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for ```is_integral<T>::value```
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> constexpr bool_t is_integral_v = is_integral<T>::value;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \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`.
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> struct is_signed
|
||||||
|
: detail::_is_signed<remove_cvr_t<T>> {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for ```is_signed<T>::value```
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> constexpr bool_t is_signed_v = is_signed<T>::value;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \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`.
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> struct is_unsigned
|
||||||
|
: detail::_is_unsigned<remove_cvr_t<T>> {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for ```is_unsigned<T>::value```
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> constexpr bool_t is_unsigned_v = is_unsigned<T>::value;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Floating Point Types ================================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief check if \p T is of a floating point type
|
||||||
|
///
|
||||||
|
/// \details Checks if type `T` is a floating point type and store it in `is_same::value`.
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> struct is_floating_point
|
||||||
|
: detail::_is_floating_point<remove_cvr_t<T>>{};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for ```is_floating_point<T>::value```
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> constexpr bool_t is_floating_point_v = is_floating_point<T> {};
|
||||||
|
|
||||||
|
|
||||||
|
// Pointer Types =======================================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief check if \p T is of a floating point type
|
||||||
|
///
|
||||||
|
/// \details Checks if type `T` is a floating point type and store it in `is_same::value`.
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> struct is_pointer
|
||||||
|
: detail::_is_pointer<remove_cvr_t<T>>{};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for ```is_floating_point<T>::value```
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> constexpr bool_t is_pointer_v = is_pointer<T> {};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Arithmetic Types ====================================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \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`.
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> struct is_arithmetic
|
||||||
|
: bool_constant<is_integral_v<T> or is_floating_point_v<T>>{};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for ```is_arithmetic<T>::value```
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> constexpr bool_t is_arithmetic_v = is_arithmetic<T>::value;
|
||||||
|
|
||||||
|
|
||||||
|
// fennec::is_fundamental ==============================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief check if \p T is a fundamental type, i.e. arithmetic, void, or nullptr_t
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> struct is_fundamental
|
||||||
|
: bool_constant<is_arithmetic_v<T> || is_void_v<T> || is_null_pointer_v<T>>{};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for ```is_fundamental<T>::value```
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> constexpr bool_t is_fundamental_v = is_fundamental<T>::value;
|
||||||
|
|
||||||
|
|
||||||
|
// fennec::is_same =====================================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \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
|
||||||
|
template<typename T0, typename T1> struct is_same : false_type {};
|
||||||
|
|
||||||
|
// true case
|
||||||
|
template<typename T> struct is_same<T, T> : true_type {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for ```is_same<T0, T1>::value```
|
||||||
|
/// \tparam T0 first type to check
|
||||||
|
/// \tparam T1 second type to check
|
||||||
|
template<typename T0, typename T1> constexpr bool_t is_same_v = is_same<T0, T1> {};
|
||||||
|
|
||||||
|
// fennec::is_complete ==============================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief check if type `T` is complete
|
||||||
|
///
|
||||||
|
/// \details Checks if `T`
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> struct is_complete : detail::_is_complete<T>::type {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for `is_complete<TypeT0, TypeT1>::value`
|
||||||
|
/// \tparam T type to check
|
||||||
|
template<typename T> constexpr bool_t is_complete_v = is_complete<T>{};
|
||||||
|
|
||||||
|
// fennec::is_convertible ==============================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \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)> {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for `can_convert<TypeT0, TypeT1>::value`
|
||||||
|
/// \param FromT First type
|
||||||
|
/// \param ToT Second type
|
||||||
|
template<typename FromT, typename ToT> constexpr bool_t is_convertible_v = is_convertible<FromT, ToT>{};
|
||||||
|
|
||||||
|
|
||||||
|
// fennec::is_constructible ============================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Check if `ClassT` can be constructed with `ArgsT,` i.e. `ClassT(ArgsT...)`.
|
||||||
|
/// This may be read as "is `ClassT` constructible with `ArgsT`"
|
||||||
|
/// \tparam ClassT The class type to test
|
||||||
|
/// \tparam ArgsT The arguments for the specific constructor
|
||||||
|
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...>{};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Check if `ClassT` is trivially constructible
|
||||||
|
/// \tparam ClassT The class type to test
|
||||||
|
template<typename ClassT> struct is_trivially_constructible
|
||||||
|
: bool_constant<FENNEC_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE(ClassT)> {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Shorthand for `is_trivially_constructible<ClassT, ArgsT...>::value`
|
||||||
|
template<typename ClassT> constexpr bool_t is_trivially_constructible_v = is_trivially_constructible<ClassT>{};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Check if `ClassT` is default constructible
|
||||||
|
/// \tparam ClassT The class type to test
|
||||||
|
template<typename ClassT> struct is_default_constructible
|
||||||
|
: bool_constant<FENNEC_BUILTIN_IS_CONSTRUCTIBLE(ClassT,)> {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Shorthand for `is_default_constructible<ClassT>::value`
|
||||||
|
template<typename ClassT, typename...ArgsT> constexpr bool_t is_default_constructible_v = is_default_constructible<ClassT>{};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Check if `ClassT` is copy constructible
|
||||||
|
/// \tparam ClassT The class type to test
|
||||||
|
template<typename ClassT> struct is_copy_constructible
|
||||||
|
: bool_constant<FENNEC_BUILTIN_IS_CONSTRUCTIBLE(ClassT, add_lvalue_reference_t<const ClassT>)> {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Shorthand for `is_copy_constructible<ClassT>::value`
|
||||||
|
template<typename ClassT, typename...ArgsT> constexpr bool_t is_copy_constructible_v = is_copy_constructible<ClassT>{};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Check if `ClassT` is copy constructible
|
||||||
|
/// \tparam ClassT The class type to test
|
||||||
|
template<typename ClassT> struct is_move_constructible
|
||||||
|
: bool_constant<FENNEC_BUILTIN_IS_CONSTRUCTIBLE(ClassT, add_rvalue_reference_t<ClassT>)> {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Shorthand for `is_copy_constructible<ClassT>::value`
|
||||||
|
template<typename ClassT, typename...ArgsT> constexpr bool_t is_move_constructible_v = is_move_constructible<ClassT>{};
|
||||||
|
|
||||||
|
|
||||||
|
// fennec::is_destructible ===================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Check if `ClassT` is destructible
|
||||||
|
/// \tparam ClassT The class type to test
|
||||||
|
template<typename ClassT> struct is_destructible
|
||||||
|
: detail::_is_destructible<ClassT>::type {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Shorthand for `is_destructible<ClassT, ArgsT...>::value`
|
||||||
|
template<typename ClassT> constexpr bool_t is_destructible_v = is_destructible<ClassT>{};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Check if `ClassT` is trivially destructible
|
||||||
|
/// \tparam ClassT The class type to test
|
||||||
|
template<typename ClassT> struct is_trivially_destructible
|
||||||
|
: bool_constant<FENNEC_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE(ClassT)> {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Shorthand for `is_trivially_destructible<ClassT, ArgsT...>::value`
|
||||||
|
template<typename ClassT> constexpr bool_t is_trivially_destructible_v = is_trivially_destructible<ClassT>{};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Check if `ClassT` is nothrow destructible
|
||||||
|
/// \tparam ClassT The class type to test
|
||||||
|
template<typename ClassT> struct is_nothrow_destructible
|
||||||
|
: detail::_is_nothrow_destructible<ClassT>::type {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Shorthand for `is_nothrow_destructible<ClassT, ArgsT...>::value`
|
||||||
|
template<typename ClassT> constexpr bool_t is_nothrow_destructible_v = is_nothrow_destructible<ClassT>{};
|
||||||
|
|
||||||
|
|
||||||
|
// fennec::is_assignable ===============================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Check if `ClassT` can be constructed with `ArgsT,` i.e. `ClassT(ArgsT...)`.
|
||||||
|
/// This may be read as "is `ClassT` constructible with `ArgsT`"
|
||||||
|
/// \tparam ClassAT The class type to test
|
||||||
|
/// \tparam ClassBT The arguments for the specific constructor
|
||||||
|
template<typename ClassAT, typename ClassBT> struct is_assignable
|
||||||
|
: bool_constant<FENNEC_BUILTIN_IS_ASSIGNABLE(ClassAT, ClassBT)> {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Shorthand for `is_constructible<ClassT, ArgsT...>::value`
|
||||||
|
template<typename ClassT, typename...ArgsT> constexpr bool_t is_assignable_v = is_assignable<ClassT, ArgsT...>{};
|
||||||
|
|
||||||
|
|
||||||
|
// fennec::is_copy_assignable ==========================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Check if `ClassT` is copy assignable
|
||||||
|
/// \tparam ClassT The class type to test
|
||||||
|
template<typename ClassT> struct is_copy_assignable
|
||||||
|
: bool_constant<FENNEC_BUILTIN_IS_ASSIGNABLE(add_lvalue_reference_t<ClassT>, add_lvalue_reference_t<const ClassT>)> {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Shorthand for `is_copy_assignable<ClassT>::value`
|
||||||
|
template<typename ClassT> constexpr bool_t is_copy_assignable_v = is_copy_assignable<ClassT>{};
|
||||||
|
|
||||||
|
|
||||||
|
// fennec::is_move_assignable ==========================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Check if `ClassT` is move assignable
|
||||||
|
/// \tparam ClassT The class type to test
|
||||||
|
template<typename ClassT> struct is_move_assignable
|
||||||
|
: bool_constant<FENNEC_BUILTIN_IS_ASSIGNABLE(add_lvalue_reference_t<ClassT>, add_rvalue_reference_t<ClassT>)> {};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Shorthand for `is_move_assignable<ClassT>::value`
|
||||||
|
template<typename ClassT> constexpr bool_t is_move_assignable_v = is_move_assignable<ClassT>{};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FENNEC_LANG_TYPE_TRAITS_H
|
||||||
@@ -31,8 +31,9 @@
|
|||||||
#ifndef FENNEC_LANG_TYPE_TRANSFORMS_H
|
#ifndef FENNEC_LANG_TYPE_TRANSFORMS_H
|
||||||
#define FENNEC_LANG_TYPE_TRANSFORMS_H
|
#define FENNEC_LANG_TYPE_TRANSFORMS_H
|
||||||
|
|
||||||
#include <fennec/lang/type_identity.h>
|
#include <fennec/langcpp/type_identity.h>
|
||||||
#include <fennec/lang/detail/_type_transforms.h>
|
#include <fennec/langcpp/detail/_type_traits.h>
|
||||||
|
#include <fennec/langcpp/detail/_type_transforms.h>
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \page fennec_lang_type_transforms Type Transforms
|
/// \page fennec_lang_type_transforms Type Transforms
|
||||||
@@ -40,7 +41,7 @@
|
|||||||
/// \brief Part of the fennec metaprogramming library. This header defines structures for copying types with different traits
|
/// \brief Part of the fennec metaprogramming library. This header defines structures for copying types with different traits
|
||||||
/// or rather, transform them, at compile time.
|
/// or rather, transform them, at compile time.
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/lang/type_transforms.h> \endcode
|
/// \code #include <fennec/langcpp/type_transforms.h> \endcode
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_transforms">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_transforms">
|
||||||
@@ -154,6 +155,20 @@ template<typename T> struct remove_pointer<T*> : type_identity<T> {};
|
|||||||
template<typename T> using remove_pointer_t = typename remove_pointer<T>::type;
|
template<typename T> using remove_pointer_t = typename remove_pointer<T>::type;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief removes all pointer levels from \p T
|
||||||
|
///
|
||||||
|
/// \details removes all pointers from the provided type such that `T*`, `T**`, etc. becomes `T`
|
||||||
|
/// \tparam T Resultant Type
|
||||||
|
template<typename T> struct strip_pointers : conditional_t<
|
||||||
|
detail::_is_pointer<T>::value,
|
||||||
|
strip_pointers<remove_pointer_t<T>>,
|
||||||
|
type_identity<T>
|
||||||
|
> {};
|
||||||
|
|
||||||
|
template<typename T> using strip_pointers_t = strip_pointers<T>::type;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Reference Conversions ===============================================================================================
|
// Reference Conversions ===============================================================================================
|
||||||
|
|
||||||
@@ -347,6 +362,20 @@ template<typename T> struct remove_cvr : type_identity<remove_cv_t<remove_refere
|
|||||||
/// \brief shorthand for `typename remove_cvr<T>::type`
|
/// \brief shorthand for `typename remove_cvr<T>::type`
|
||||||
template<typename T> using remove_cvr_t = typename remove_cvr<T>::type;
|
template<typename T> using remove_cvr_t = typename remove_cvr<T>::type;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief removes references and pointers as well as the const and volatile qualifiers from the provided type \p T
|
||||||
|
///
|
||||||
|
/// \details removes const and volatile from the provided type such that
|
||||||
|
/// \tparam T Reference Type
|
||||||
|
template<typename T> struct remove_cvrp : type_identity<remove_cv_t<remove_reference_t<strip_pointers_t<T>>>> {};
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief shorthand for `typename remove_cvrp_t<T>::type`
|
||||||
|
template<typename T> using remove_cvrp_t = typename remove_cvrp<T>::type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FENNEC_LANG_TYPE_TRANSFORMS_H
|
#endif // FENNEC_LANG_TYPE_TRANSFORMS_H
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
///
|
///
|
||||||
/// \page fennec_lang_types Types
|
/// \page fennec_lang_types Types
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/lang/types.h> \endcode
|
/// \code #include <fennec/langcpp/types.h> \endcode
|
||||||
///
|
///
|
||||||
/// \brief This header contains definitions for the built-in types of the C++ language.
|
/// \brief This header contains definitions for the built-in types of the C++ language.
|
||||||
///
|
///
|
||||||
@@ -201,9 +201,9 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/lang/detail/_int.h>
|
#include <fennec/langcpp/detail/_int.h>
|
||||||
|
|
||||||
#include <fennec/lang/conditional_types.h>
|
#include <fennec/langcpp/conditional_types.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
///
|
///
|
||||||
/// \brief This header contains common utility functions related to the C++ language.
|
/// \brief This header contains common utility functions related to the C++ language.
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/lang/utility.h> \endcode
|
/// \code #include <fennec/langcpp/utility.h> \endcode
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_utility">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_utility">
|
||||||
/// <tr><th style="vertical-align: top">Syntax
|
/// <tr><th style="vertical-align: top">Syntax
|
||||||
@@ -59,8 +59,8 @@
|
|||||||
/// </table>
|
/// </table>
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/lang/type_transforms.h>
|
#include <fennec/langcpp/type_transforms.h>
|
||||||
#include <fennec/lang/type_traits.h>
|
#include <fennec/langcpp/type_traits.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -123,9 +123,19 @@ constexpr void swap(T& x, T& y) noexcept {
|
|||||||
/// \param x first value
|
/// \param x first value
|
||||||
/// \param y second value
|
/// \param y second value
|
||||||
template<typename T> constexpr void swap(T& x, T& y) noexcept {
|
template<typename T> constexpr void swap(T& x, T& y) noexcept {
|
||||||
|
|
||||||
|
#if FENNEC_COMPILER_GCC
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||||
|
#endif
|
||||||
|
|
||||||
T a = fennec::move(x);
|
T a = fennec::move(x);
|
||||||
x = fennec::move(y);
|
x = fennec::move(y);
|
||||||
y = fennec::move(a);
|
y = fennec::move(a);
|
||||||
|
|
||||||
|
#if FENNEC_COMPILER_GCC
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -271,7 +271,7 @@
|
|||||||
|
|
||||||
#include <fennec/math/detail/_math.h>
|
#include <fennec/math/detail/_math.h>
|
||||||
|
|
||||||
#include <fennec/lang/limits.h>
|
#include <fennec/langcpp/limits.h>
|
||||||
|
|
||||||
#include <fennec/math/vector.h>
|
#include <fennec/math/vector.h>
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_MATH_DETAIL_TYPES_H
|
#ifndef FENNEC_MATH_DETAIL_TYPES_H
|
||||||
#define FENNEC_MATH_DETAIL_TYPES_H
|
#define FENNEC_MATH_DETAIL_TYPES_H
|
||||||
|
|
||||||
#include <fennec/lang/const_sequences.h>
|
#include <fennec/langcpp/const_sequences.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include <fennec/math/detail/_fwd.h>
|
#include <fennec/math/detail/_fwd.h>
|
||||||
|
|
||||||
#include <fennec/lang/type_traits.h>
|
#include <fennec/langcpp/type_traits.h>
|
||||||
#include <fennec/math/swizzle.h>
|
#include <fennec/math/swizzle.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_MATH_EXT_COMMON_H
|
#ifndef FENNEC_MATH_EXT_COMMON_H
|
||||||
#define FENNEC_MATH_EXT_COMMON_H
|
#define FENNEC_MATH_EXT_COMMON_H
|
||||||
|
|
||||||
#include <fennec/lang/limits.h>
|
#include <fennec/langcpp/limits.h>
|
||||||
|
|
||||||
#include <fennec/math/trigonometric.h>
|
#include <fennec/math/trigonometric.h>
|
||||||
#include <fennec/math/ext/quaternion.h>
|
#include <fennec/math/ext/quaternion.h>
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
|
|
||||||
#include <fennec/math/detail/_fwd.h>
|
#include <fennec/math/detail/_fwd.h>
|
||||||
#include <fennec/math/detail/_types.h>
|
#include <fennec/math/detail/_types.h>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/lang/const_sequences.h>
|
#include <fennec/langcpp/const_sequences.h>
|
||||||
|
|
||||||
#include <fennec/math/swizzle_storage.h>
|
#include <fennec/math/swizzle_storage.h>
|
||||||
|
|
||||||
|
|||||||
@@ -108,9 +108,9 @@
|
|||||||
#include <fennec/math/vector_base.h>
|
#include <fennec/math/vector_base.h>
|
||||||
#include <fennec/math/vector_traits.h>
|
#include <fennec/math/vector_traits.h>
|
||||||
|
|
||||||
#include <fennec/lang/conditional_types.h>
|
#include <fennec/langcpp/conditional_types.h>
|
||||||
#include <fennec/lang/type_traits.h>
|
#include <fennec/langcpp/type_traits.h>
|
||||||
#include <fennec/lang/utility.h>
|
#include <fennec/langcpp/utility.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,10 +35,10 @@
|
|||||||
#include <fennec/memory/pointer_traits.h>
|
#include <fennec/memory/pointer_traits.h>
|
||||||
#include <fennec/memory/new.h>
|
#include <fennec/memory/new.h>
|
||||||
|
|
||||||
#include <fennec/lang/conditional_types.h>
|
#include <fennec/langcpp/conditional_types.h>
|
||||||
#include <fennec/lang/numeric_transforms.h>
|
#include <fennec/langcpp/numeric_transforms.h>
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/lang/type_traits.h>
|
#include <fennec/langcpp/type_traits.h>
|
||||||
|
|
||||||
#include <fennec/math/ext/constants.h>
|
#include <fennec/math/ext/constants.h>
|
||||||
#include <fennec/math/common.h>
|
#include <fennec/math/common.h>
|
||||||
@@ -366,7 +366,8 @@ public:
|
|||||||
constexpr allocation(size_t n, const alloc_t& alloc) noexcept
|
constexpr allocation(size_t n, const alloc_t& alloc) noexcept
|
||||||
: _alloc(alloc)
|
: _alloc(alloc)
|
||||||
, _data(nullptr)
|
, _data(nullptr)
|
||||||
, _capacity(0) {
|
, _capacity(0)
|
||||||
|
, _alignment(zero<align_t>()) {
|
||||||
callocate(n);
|
callocate(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,7 +451,7 @@ public:
|
|||||||
/// \param alloc the allocation to copy
|
/// \param alloc the allocation to copy
|
||||||
/// \returns a reference to `this`
|
/// \returns a reference to `this`
|
||||||
constexpr allocation& operator=(const allocation& alloc) {
|
constexpr allocation& operator=(const allocation& alloc) {
|
||||||
allocation::allocate(alloc.capacity());
|
allocation::allocate(alloc.capacity(), alloc.alignment());
|
||||||
fennec::memmove(_data, alloc, size());
|
fennec::memmove(_data, alloc, size());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -465,12 +466,13 @@ public:
|
|||||||
fennec::swap(_alloc, alloc._alloc);
|
fennec::swap(_alloc, alloc._alloc);
|
||||||
fennec::swap(_data, alloc._data);
|
fennec::swap(_data, alloc._data);
|
||||||
fennec::swap(_capacity, alloc._capacity);
|
fennec::swap(_capacity, alloc._capacity);
|
||||||
|
fennec::swap(_alignment, alloc._alignment);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Allocation and Deallocation =====================================================================================
|
// Allocation and Deallocation =========================================================================================
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \brief Allocate a block of memory for the allocation.
|
/// \brief Allocate a block of memory for the allocation.
|
||||||
@@ -627,6 +629,10 @@ public:
|
|||||||
return _data;
|
return _data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr align_t alignment() const {
|
||||||
|
return _alignment;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
alloc_t _alloc; // Allocator object
|
alloc_t _alloc; // Allocator object
|
||||||
value_t* _data; // Handle for the memory block
|
value_t* _data; // Handle for the memory block
|
||||||
|
|||||||
@@ -19,9 +19,9 @@
|
|||||||
#ifndef FENNEC_LANG_BYTES_H
|
#ifndef FENNEC_LANG_BYTES_H
|
||||||
#define FENNEC_LANG_BYTES_H
|
#define FENNEC_LANG_BYTES_H
|
||||||
|
|
||||||
#include <fennec/lang/assert.h>
|
#include <fennec/langcpp/assert.h>
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/lang/hashing.h>
|
#include <fennec/langcpp/hashing.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#ifndef FENNEC_MEMORY_H
|
#ifndef FENNEC_MEMORY_H
|
||||||
#define FENNEC_MEMORY_H
|
#define FENNEC_MEMORY_H
|
||||||
|
|
||||||
#include <fennec/lang/type_traits.h>
|
#include <fennec/langcpp/type_traits.h>
|
||||||
#include <fennec/memory/detail/_string.h>
|
#include <fennec/memory/detail/_string.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
#ifndef FENNEC_MEMORY_DETAIL_PTR_TRAITS_H
|
#ifndef FENNEC_MEMORY_DETAIL_PTR_TRAITS_H
|
||||||
#define FENNEC_MEMORY_DETAIL_PTR_TRAITS_H
|
#define FENNEC_MEMORY_DETAIL_PTR_TRAITS_H
|
||||||
|
|
||||||
#include <fennec/lang/conditional_types.h>
|
#include <fennec/langcpp/conditional_types.h>
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/lang/type_traits.h>
|
#include <fennec/langcpp/type_traits.h>
|
||||||
#include <fennec/lang/type_sequences.h>
|
#include <fennec/langcpp/type_sequences.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
#ifndef FENNEC_MEMORY_NEW_H
|
#ifndef FENNEC_MEMORY_NEW_H
|
||||||
#define FENNEC_MEMORY_NEW_H
|
#define FENNEC_MEMORY_NEW_H
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/lang/utility.h>
|
#include <fennec/langcpp/utility.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_MEMORY_PTR_TRAITS_H
|
#ifndef FENNEC_MEMORY_PTR_TRAITS_H
|
||||||
#define FENNEC_MEMORY_PTR_TRAITS_H
|
#define FENNEC_MEMORY_PTR_TRAITS_H
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/memory/detail/_ptr_traits.h>
|
#include <fennec/memory/detail/_ptr_traits.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_MEMORY_POINTERS_H
|
#ifndef FENNEC_MEMORY_POINTERS_H
|
||||||
#define FENNEC_MEMORY_POINTERS_H
|
#define FENNEC_MEMORY_POINTERS_H
|
||||||
|
|
||||||
#include <fennec/lang/type_traits.h>
|
#include <fennec/langcpp/type_traits.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -45,7 +45,7 @@ struct default_delete
|
|||||||
/// \param ptr Memory resource to delete
|
/// \param ptr Memory resource to delete
|
||||||
constexpr void operator()(TypeT* ptr) const noexcept {
|
constexpr void operator()(TypeT* ptr) const noexcept {
|
||||||
static_assert(not is_void_v<TypeT>, "cannot delete a pointer to an incomplete type");
|
static_assert(not is_void_v<TypeT>, "cannot delete a pointer to an incomplete type");
|
||||||
static_assert(not sizeof(TypeT) > 0, "cannot delete a pointer to an incomplete type");
|
static_assert(is_complete_v<TypeT>, "cannot delete a pointer to an incomplete type");
|
||||||
delete ptr;
|
delete ptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -70,7 +70,7 @@ struct default_delete<TypeT[]>
|
|||||||
template<class ArrT> requires requires { is_convertible_v<ArrT(*)[], TypeT(*)[]> == true; }
|
template<class ArrT> requires requires { is_convertible_v<ArrT(*)[], TypeT(*)[]> == true; }
|
||||||
constexpr void operator()(TypeT* ptr) const noexcept {
|
constexpr void operator()(TypeT* ptr) const noexcept {
|
||||||
static_assert(not is_void_v<TypeT>, "cannot delete a pointer to an incomplete type");
|
static_assert(not is_void_v<TypeT>, "cannot delete a pointer to an incomplete type");
|
||||||
static_assert(not sizeof(TypeT) > 0, "cannot delete a pointer to an incomplete type");
|
static_assert(is_complete_v<TypeT>, "cannot delete a pointer to an incomplete type");
|
||||||
delete[] ptr;
|
delete[] ptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -91,6 +91,9 @@ public:
|
|||||||
/// \brief pointer to element type
|
/// \brief pointer to element type
|
||||||
using pointer_t = element_t*;
|
using pointer_t = element_t*;
|
||||||
|
|
||||||
|
/// \brief pointer to element type
|
||||||
|
using const_pointer_t = const element_t*;
|
||||||
|
|
||||||
/// \brief the deleter
|
/// \brief the deleter
|
||||||
using delete_t = DeleteT;
|
using delete_t = DeleteT;
|
||||||
|
|
||||||
@@ -100,7 +103,7 @@ public:
|
|||||||
|
|
||||||
///
|
///
|
||||||
/// \brief Nullptr Constructor, creates a unique_ptr that owns nothing.
|
/// \brief Nullptr Constructor, creates a unique_ptr that owns nothing.
|
||||||
constexpr unique_ptr(nullptr_t) noexcept : unique_ptr(nullptr) {}
|
constexpr unique_ptr(nullptr_t) noexcept : unique_ptr(nullptr, delete_t()) {}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \brief Pointer Constructor, creates a unique_ptr that owns `ptr` with deleter `del`
|
/// \brief Pointer Constructor, creates a unique_ptr that owns `ptr` with deleter `del`
|
||||||
@@ -115,7 +118,7 @@ public:
|
|||||||
/// \brief Pointer Constructor, creates a unique_ptr that owns `ptr` with deleter `del`
|
/// \brief Pointer Constructor, creates a unique_ptr that owns `ptr` with deleter `del`
|
||||||
/// \param ptr The resource to own
|
/// \param ptr The resource to own
|
||||||
/// \param del The deleter
|
/// \param del The deleter
|
||||||
explicit constexpr unique_ptr(pointer_t ptr, delete_t&& del)
|
explicit constexpr unique_ptr(pointer_t ptr, delete_t&& del = delete_t())
|
||||||
: _delete(del)
|
: _delete(del)
|
||||||
, _handle(ptr) {
|
, _handle(ptr) {
|
||||||
}
|
}
|
||||||
@@ -152,12 +155,39 @@ public:
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pointer_t get() {
|
||||||
|
return _handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool empty() {
|
||||||
|
return _handle == nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
pointer_t operator->() {
|
||||||
|
return _handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
const_pointer_t operator->() const {
|
||||||
|
return _handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
delete_t _delete;
|
delete_t _delete;
|
||||||
pointer_t _handle;
|
pointer_t _handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Creates a unique pointer holding an object of type `TypeT`
|
||||||
|
/// \tparam TypeT The type
|
||||||
|
/// \tparam ArgsT The constructor arguments, automatically deduced
|
||||||
|
/// \param args The constructor arguments
|
||||||
|
/// \returns A unique pointer holding a heap allocated object of type `TypeT` constructed with arguments `args`
|
||||||
|
template<typename TypeT, typename...ArgsT>
|
||||||
|
unique_ptr<TypeT> make_unique(ArgsT&&...args) {
|
||||||
|
return unique_ptr<TypeT>(new TypeT(fennec::forward<ArgsT>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FENNEC_MEMORY_POINTERS_H
|
#endif // FENNEC_MEMORY_POINTERS_H
|
||||||
|
|||||||
@@ -21,9 +21,8 @@
|
|||||||
|
|
||||||
#include <fennec/containers/list.h>
|
#include <fennec/containers/list.h>
|
||||||
#include <fennec/containers/sequence.h>
|
#include <fennec/containers/sequence.h>
|
||||||
#include <fennec/langproc/strings/cstring.h>
|
#include <fennec/lang/strings/cstring.h>
|
||||||
#include <fennec/langproc/strings/string.h>
|
#include <fennec/lang/strings/string.h>
|
||||||
#include <fennec/lang/typed.h>
|
|
||||||
#include <fennec/platform/interface/fwd.h>
|
#include <fennec/platform/interface/fwd.h>
|
||||||
#include <fennec/platform/interface/window.h>
|
#include <fennec/platform/interface/window.h>
|
||||||
|
|
||||||
@@ -61,7 +60,7 @@
|
|||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|
||||||
class platform : public typed<platform> {
|
class platform {
|
||||||
public:
|
public:
|
||||||
using shared_object = struct shared_object;
|
using shared_object = struct shared_object;
|
||||||
using symbol = void*;
|
using symbol = void*;
|
||||||
@@ -131,9 +130,8 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
template<typename PlatformT>
|
template<typename PlatformT>
|
||||||
explicit platform(const cstring& name, PlatformT* type)
|
explicit platform(const cstring& name, PlatformT*)
|
||||||
: typed(type)
|
: name(name) {
|
||||||
, name(name) {
|
|
||||||
assertf(globals.singleton == nullptr, "Conflicting platform implementations!");
|
assertf(globals.singleton == nullptr, "Conflicting platform implementations!");
|
||||||
globals.singleton = this;
|
globals.singleton = this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,8 @@
|
|||||||
#ifndef FENNEC_PLATFORM_INTERFACE_WINDOW_H
|
#ifndef FENNEC_PLATFORM_INTERFACE_WINDOW_H
|
||||||
#define FENNEC_PLATFORM_INTERFACE_WINDOW_H
|
#define FENNEC_PLATFORM_INTERFACE_WINDOW_H
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/langproc/strings/string.h>
|
#include <fennec/lang/strings/string.h>
|
||||||
#include <fennec/renderers/interface/gfxcontext.h>
|
#include <fennec/renderers/interface/gfxcontext.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
|
|||||||
@@ -31,8 +31,8 @@
|
|||||||
#ifndef FENNEC_RENDERERS_INTERFACE_GFXCONTEXT_H
|
#ifndef FENNEC_RENDERERS_INTERFACE_GFXCONTEXT_H
|
||||||
#define FENNEC_RENDERERS_INTERFACE_GFXCONTEXT_H
|
#define FENNEC_RENDERERS_INTERFACE_GFXCONTEXT_H
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/langproc/strings/string.h>
|
#include <fennec/lang/strings/string.h>
|
||||||
#include <fennec/renderers/interface/forward.h>
|
#include <fennec/renderers/interface/forward.h>
|
||||||
#include <fennec/renderers/interface/gfxresourcepool.h>
|
#include <fennec/renderers/interface/gfxresourcepool.h>
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@
|
|||||||
#ifndef FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H
|
#ifndef FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H
|
||||||
#define FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H
|
#define FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/langproc/strings/string.h>
|
#include <fennec/lang/strings/string.h>
|
||||||
#include <fennec/renderers/interface/forward.h>
|
#include <fennec/renderers/interface/forward.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
|
|||||||
33
include/fennec/rtti/detail/_constants.h
Normal file
33
include/fennec/rtti/detail/_constants.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// 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_RTTI_DETAIL_CONSTANTS_H
|
||||||
|
#define FENNEC_RTTI_DETAIL_CONSTANTS_H
|
||||||
|
|
||||||
|
#include <fennec/langcpp/types.h>
|
||||||
|
|
||||||
|
namespace fennec::detail
|
||||||
|
{
|
||||||
|
|
||||||
|
// const char* fennec::detail::f() [with T = void]
|
||||||
|
inline static constexpr size_t type_name_f_heading = 42;
|
||||||
|
inline static constexpr size_t type_name_f_footing = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FENNEC_RTTI_DETAIL_CONSTANTS_H
|
||||||
53
include/fennec/rtti/detail/_type_name.h
Normal file
53
include/fennec/rtti/detail/_type_name.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// 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 _type_name.h
|
||||||
|
/// \brief
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \details
|
||||||
|
/// \author Medusa Slockbower
|
||||||
|
///
|
||||||
|
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
#ifndef FENNEC_RTTI_DETAIL_TYPE_NAME_H
|
||||||
|
#define FENNEC_RTTI_DETAIL_TYPE_NAME_H
|
||||||
|
|
||||||
|
#include <fennec/lang/strings/string.h>
|
||||||
|
#include <fennec/rtti/detail/_constants.h>
|
||||||
|
|
||||||
|
namespace fennec::detail
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline static const char* f() {
|
||||||
|
static constexpr const char* name = FENNEC_FUNCTION_NAME;
|
||||||
|
return name + type_name_f_heading;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline static string_view type_name() {
|
||||||
|
return string_view(f<T>(), ::strlen(f<T>()) - type_name_f_footing);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FENNEC_RTTI_DETAIL_TYPE_NAME_H
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_LANG_DETAIL_TYPEUUID_H
|
#ifndef FENNEC_LANG_DETAIL_TYPEUUID_H
|
||||||
#define FENNEC_LANG_DETAIL_TYPEUUID_H
|
#define FENNEC_LANG_DETAIL_TYPEUUID_H
|
||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/langcpp/types.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
42
include/fennec/rtti/enable.h
Normal file
42
include/fennec/rtti/enable.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// 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 enable.h
|
||||||
|
/// \brief
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \details
|
||||||
|
/// \author Medusa Slockbower
|
||||||
|
///
|
||||||
|
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
#ifndef FENNEC_RTTI_ENABLE_H
|
||||||
|
#define FENNEC_RTTI_ENABLE_H
|
||||||
|
|
||||||
|
#include <fennec/rtti/type.h>
|
||||||
|
#include <fennec/rtti/typelist.h>
|
||||||
|
|
||||||
|
#define FENNEC_RTTI_ENABLE(...) \
|
||||||
|
public: \
|
||||||
|
using super_class_list = fennec::typelist<__VA_ARGS__>; \
|
||||||
|
virtual fennec::type get_type() { return fennec::type::get_from_instance(this); }
|
||||||
|
|
||||||
|
#endif // FENNEC_RTTI_ENABLE_H
|
||||||
34
include/fennec/rtti/forward.h
Normal file
34
include/fennec/rtti/forward.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// 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 forward.h
|
||||||
|
/// \brief
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \details
|
||||||
|
/// \author Medusa Slockbower
|
||||||
|
///
|
||||||
|
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
#ifndef FENNEC_RTTI_FORWARD_H
|
||||||
|
#define FENNEC_RTTI_FORWARD_H
|
||||||
|
|
||||||
|
#endif // FENNEC_RTTI_FORWARD_H
|
||||||
86
include/fennec/rtti/type.h
Normal file
86
include/fennec/rtti/type.h
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// 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 type.h
|
||||||
|
/// \brief
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \details
|
||||||
|
/// \author Medusa Slockbower
|
||||||
|
///
|
||||||
|
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
#ifndef FENNEC_RTTI_TYPE_H
|
||||||
|
#define FENNEC_RTTI_TYPE_H
|
||||||
|
|
||||||
|
#include <fennec/langcpp/types.h>
|
||||||
|
#include <fennec/rtti/type_data.h>
|
||||||
|
|
||||||
|
namespace fennec
|
||||||
|
{
|
||||||
|
|
||||||
|
struct type {
|
||||||
|
|
||||||
|
const string& name() const {
|
||||||
|
return _data->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t id() const {
|
||||||
|
return _data->uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
dynarray<type> supertypes() const {
|
||||||
|
return _data->supers;
|
||||||
|
}
|
||||||
|
|
||||||
|
dynarray<type> subtypes() const {
|
||||||
|
return _data->subs;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const type& c) const {
|
||||||
|
return _data == c._data;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Get the type info of the specified type
|
||||||
|
/// \tparam TypeT The type to check
|
||||||
|
/// \returns A type struct containing information about TypeT
|
||||||
|
template<typename TypeT>
|
||||||
|
static type get() { return type(static_cast<TypeT*>(nullptr)); }
|
||||||
|
|
||||||
|
template<typename TypeT>
|
||||||
|
static type get_from_instance(TypeT* t) { return type(t); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
const type_data* const _data;
|
||||||
|
|
||||||
|
template<typename TypeT>
|
||||||
|
type(TypeT*) : _data(type_storage::get_data<TypeT>()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
type(type_data* d) : _data(d) { }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FENNEC_RTTI_TYPE_H
|
||||||
111
include/fennec/rtti/type_data.h
Normal file
111
include/fennec/rtti/type_data.h
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// 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 type_data.h
|
||||||
|
/// \brief
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \details
|
||||||
|
/// \author Medusa Slockbower
|
||||||
|
///
|
||||||
|
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
#ifndef FENNEC_RTTI_TYPE_DATA_H
|
||||||
|
#define FENNEC_RTTI_TYPE_DATA_H
|
||||||
|
|
||||||
|
#include <fennec/containers/dynarray.h>
|
||||||
|
#include <fennec/containers/optional.h>
|
||||||
|
#include <fennec/lang/strings/string.h>
|
||||||
|
#include <fennec/memory/pointers.h>
|
||||||
|
#include <fennec/rtti/typeid.h>
|
||||||
|
#include <fennec/rtti/typelist.h>
|
||||||
|
#include <fennec/rtti/detail/_type_name.h>
|
||||||
|
|
||||||
|
namespace fennec
|
||||||
|
{
|
||||||
|
|
||||||
|
struct type_data {
|
||||||
|
uint64_t uuid;
|
||||||
|
string name;
|
||||||
|
|
||||||
|
type_data* raw_type;
|
||||||
|
dynarray<type_data*> supers;
|
||||||
|
dynarray<type_data*> subs;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct type_storage {
|
||||||
|
private:
|
||||||
|
template<typename ClassT> using _super_class_list = typename ClassT::super_class_list;
|
||||||
|
|
||||||
|
static dynarray<unique_ptr<type_data>>& _typelist() {
|
||||||
|
static dynarray<unique_ptr<type_data>> typelist;
|
||||||
|
return typelist;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
static unique_ptr<type_data> _make_data() {
|
||||||
|
using raw_t = remove_cvrp_t<T>;
|
||||||
|
using supers_t = detect_t<typelist<>, _super_class_list, T>;
|
||||||
|
|
||||||
|
auto res = fennec::unique_ptr<type_data>(new type_data{
|
||||||
|
.uuid = typeuuid<T>(),
|
||||||
|
.name = detail::type_name<T>(),
|
||||||
|
|
||||||
|
.raw_type = typeuuid<raw_t>() == typeuuid<T>() ? nullptr : type_storage::get_data<raw_t>(),
|
||||||
|
.supers = type_storage::get_data(supers_t{}),
|
||||||
|
.subs = {}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (type_data* t : res->supers) {
|
||||||
|
t->subs.push_back(res.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
template<typename T>
|
||||||
|
static type_data* get_data() {
|
||||||
|
auto& typelist = _typelist();
|
||||||
|
uint64_t uuid = typeuuid<T>();
|
||||||
|
|
||||||
|
if (typelist.size() <= uuid) {
|
||||||
|
typelist.resize(uuid * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typelist[uuid].empty()) {
|
||||||
|
typelist[uuid] = fennec::forward<unique_ptr<type_data>>(_make_data<T>());
|
||||||
|
}
|
||||||
|
|
||||||
|
return typelist[uuid].get();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename...Ts>
|
||||||
|
static dynarray<type_data*> get_data(typelist<Ts...>) {
|
||||||
|
return {
|
||||||
|
get_data<Ts>()...
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FENNEC_RTTI_TYPE_DATA_H
|
||||||
@@ -19,11 +19,8 @@
|
|||||||
#ifndef FENNEC_LANG_TYPEUUID_H
|
#ifndef FENNEC_LANG_TYPEUUID_H
|
||||||
#define FENNEC_LANG_TYPEUUID_H
|
#define FENNEC_LANG_TYPEUUID_H
|
||||||
|
|
||||||
#include <fennec/lang/assert.h>
|
#include <fennec/langcpp/types.h>
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/rtti/detail/_typeid.h>
|
||||||
#include <fennec/lang/type_traits.h>
|
|
||||||
|
|
||||||
#include <fennec/lang/detail/_typeuuid.h>
|
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -40,27 +37,6 @@ FENNEC_NO_INLINE uint64_t typeuuid() {
|
|||||||
return id = detail::_typeuuid<RootT>();
|
return id = detail::_typeuuid<RootT>();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename RootT = void>
|
|
||||||
struct typed {
|
|
||||||
public:
|
|
||||||
const uint64_t type;
|
|
||||||
|
|
||||||
template<typename TypeT>
|
|
||||||
bool is_type() const {
|
|
||||||
return type == typeuuid<TypeT, RootT>();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename TypeT>
|
|
||||||
typed(TypeT*)
|
|
||||||
: type(typeuuid<TypeT, RootT>()) {
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename TypeT>
|
|
||||||
static uint64_t id() {
|
|
||||||
return typeuuid<TypeT, RootT>();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FENNEC_LANG_TYPEUUID_H
|
#endif // FENNEC_LANG_TYPEUUID_H
|
||||||
46
include/fennec/rtti/typelist.h
Normal file
46
include/fennec/rtti/typelist.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// 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 typelist.h
|
||||||
|
/// \brief
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \details
|
||||||
|
/// \author Medusa Slockbower
|
||||||
|
///
|
||||||
|
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
#ifndef FENNEC_RTTI_TYPELIST_H
|
||||||
|
#define FENNEC_RTTI_TYPELIST_H
|
||||||
|
|
||||||
|
#include <fennec/langcpp/types.h>
|
||||||
|
|
||||||
|
namespace fennec
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename...TypesT>
|
||||||
|
struct typelist {
|
||||||
|
static constexpr size_t size = sizeof...(TypesT);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FENNEC_RTTI_TYPELIST_H
|
||||||
@@ -23,10 +23,11 @@
|
|||||||
#include <fennec/containers/map.h>
|
#include <fennec/containers/map.h>
|
||||||
#include <fennec/containers/optional.h>
|
#include <fennec/containers/optional.h>
|
||||||
#include <fennec/containers/rdtree.h>
|
#include <fennec/containers/rdtree.h>
|
||||||
#include <fennec/lang/startup.h>
|
#include <fennec/langcpp/startup.h>
|
||||||
#include <fennec/langproc/strings/string.h>
|
#include <fennec/lang/strings/string.h>
|
||||||
#include <fennec/lang/typed.h>
|
#include <fennec/lang/filesystem/path.h>
|
||||||
#include <fennec/langproc/filesystem/path.h>
|
|
||||||
|
#include <fennec/scene/forward.h>
|
||||||
|
|
||||||
#define FENNEC_REGISTER_COMPONENT(T, p) \
|
#define FENNEC_REGISTER_COMPONENT(T, p) \
|
||||||
FENNEC_STATIC_CONSTRUCTOR(T) { \
|
FENNEC_STATIC_CONSTRUCTOR(T) { \
|
||||||
@@ -36,152 +37,15 @@
|
|||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|
||||||
class component : public typed<component> {
|
class component {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// TYPEDEFS & CONSTANTS ================================================================================================
|
|
||||||
using component_create = component* (*)(size_t, size_t);
|
|
||||||
using component_destroy = void (*)(component*);
|
|
||||||
|
|
||||||
|
|
||||||
// TYPE OPERATIONS =====================================================================================================
|
|
||||||
|
|
||||||
struct typeinfo {
|
|
||||||
string name;
|
|
||||||
component_create create;
|
|
||||||
|
|
||||||
typeinfo()
|
|
||||||
: name("")
|
|
||||||
, create(nullptr) {
|
|
||||||
}
|
|
||||||
|
|
||||||
typeinfo(const string& name,
|
|
||||||
component_create create)
|
|
||||||
: name(name)
|
|
||||||
, create(create) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct typeentry {
|
|
||||||
string name;
|
|
||||||
uint64_t type;
|
|
||||||
};
|
|
||||||
|
|
||||||
using typelist_t = dynarray<optional<typeinfo>>;
|
|
||||||
using typetree_t = rdtree<typeentry>;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Registry ====================================================================================================
|
|
||||||
private:
|
|
||||||
|
|
||||||
static typelist_t _typelist; // Actual list of types
|
|
||||||
static typetree_t _typetree; // Tree for displaying types under subfolders
|
|
||||||
|
|
||||||
static constexpr size_t npos = typetree_t::npos;
|
|
||||||
static constexpr size_t root = typetree_t::root;
|
|
||||||
|
|
||||||
static void _register_type( uint64_t id, const path& path,
|
|
||||||
component_create create) {
|
|
||||||
// Register the type
|
|
||||||
if (id > _typelist.size()) {
|
|
||||||
_typelist.resize(id + 1);
|
|
||||||
}
|
|
||||||
_typelist[id] = typeinfo{ path.filename(), create };
|
|
||||||
|
|
||||||
// Create tree entry
|
|
||||||
size_t node = root;
|
|
||||||
path::iterator it = path.begin();
|
|
||||||
while (it != path.end()) {
|
|
||||||
string name = *it++;
|
|
||||||
size_t parent = node;
|
|
||||||
bool end = it == path.end();
|
|
||||||
|
|
||||||
node = _typetree.child(parent);
|
|
||||||
|
|
||||||
while (node != npos && _typetree[node].type != id) {
|
|
||||||
node = _typetree.next(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node == npos) {
|
|
||||||
node = _typetree.emplace(
|
|
||||||
parent, npos,
|
|
||||||
name, end ? id : nullid
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Default creation function for a component
|
|
||||||
/// \tparam ComponentT Type of the component
|
|
||||||
/// \param node The node to associate the component with
|
|
||||||
/// \returns The component created by this function
|
|
||||||
template<typename ComponentT>
|
|
||||||
static constexpr component* default_create(size_t scene, size_t node) {
|
|
||||||
return new ComponentT(scene, node);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Public Registry =====================================================================================================
|
|
||||||
public:
|
|
||||||
|
|
||||||
static constexpr const typetree_t& typelist() {
|
|
||||||
return _typetree;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename ComponentT>
|
|
||||||
static constexpr const typeinfo& type_info() {
|
|
||||||
const auto& it = _typelist[id<ComponentT>()];
|
|
||||||
assert(it, "Unregistered type provided to component::type_info, see stacktrace for more info.");
|
|
||||||
return *it;
|
|
||||||
}
|
|
||||||
|
|
||||||
static constexpr const typeinfo& type_info(uint64_t type) {
|
|
||||||
const auto& it = _typelist[type];
|
|
||||||
assert(it, "Unregistered type provided to component::type_info, see stacktrace for more info.");
|
|
||||||
return *it;
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Register a type with the component system
|
|
||||||
/// \tparam ComponentT The component type
|
|
||||||
/// \param path The name of the type
|
|
||||||
/// \param create The function used to create a component, given a scene node. **MUST NOT BE NULL**
|
|
||||||
template<typename ComponentT>
|
|
||||||
static void register_type(const path& path,
|
|
||||||
component_create create = default_create<ComponentT>) {
|
|
||||||
component::_register_type(id<ComponentT>(), path, create);
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Create a component of type `type`
|
|
||||||
/// \param type The type to create
|
|
||||||
/// \param node The node to associate the component with
|
|
||||||
/// \returns The created component
|
|
||||||
static component* create(uint64_t type, size_t scene, size_t node) {
|
|
||||||
auto& typei = _typelist[type];
|
|
||||||
return typei->create(scene, node);
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Create a component of type `type`
|
|
||||||
/// \tparam ComponentT The type to create
|
|
||||||
/// \param node The node to associate the component with
|
|
||||||
/// \returns The created component
|
|
||||||
template<typename ComponentT>
|
|
||||||
static component* create(size_t scene, size_t node) {
|
|
||||||
auto& typei = _typelist[id<ComponentT>()];
|
|
||||||
return typei->create(scene, node);
|
|
||||||
}
|
|
||||||
|
|
||||||
// MEMBERS =============================================================================================================
|
// MEMBERS =============================================================================================================
|
||||||
public:
|
public:
|
||||||
const size_t node;
|
scene_node* const node;
|
||||||
|
|
||||||
template<typename ComponentT>
|
component(scene_node* node)
|
||||||
component(ComponentT* type, size_t node)
|
: node(node) {
|
||||||
: typed(type)
|
|
||||||
, node(node) {
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
43
include/fennec/scene/forward.h
Normal file
43
include/fennec/scene/forward.h
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// 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 forward.h
|
||||||
|
/// \brief
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \details
|
||||||
|
/// \author Medusa Slockbower
|
||||||
|
///
|
||||||
|
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
#ifndef FENNEC_SCENE_FORWARD_H
|
||||||
|
#define FENNEC_SCENE_FORWARD_H
|
||||||
|
|
||||||
|
namespace fennec
|
||||||
|
{
|
||||||
|
|
||||||
|
class scene;
|
||||||
|
struct scene_node;
|
||||||
|
class component;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FENNEC_SCENE_FORWARD_H
|
||||||
@@ -33,11 +33,23 @@
|
|||||||
|
|
||||||
#include <fennec/math/matrix.h>
|
#include <fennec/math/matrix.h>
|
||||||
#include <fennec/math/ext/transform.h>
|
#include <fennec/math/ext/transform.h>
|
||||||
|
|
||||||
|
#include <fennec/core/event.h>
|
||||||
|
|
||||||
#include <fennec/scene/scene_node.h>
|
#include <fennec/scene/scene_node.h>
|
||||||
|
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|
||||||
|
struct node2d;
|
||||||
|
|
||||||
|
struct transform_update_2d : event {
|
||||||
|
node2d* node;
|
||||||
|
|
||||||
|
FENNEC_RTTI_ENABLE(event);
|
||||||
|
};
|
||||||
|
|
||||||
struct node2d : scene_node {
|
struct node2d : scene_node {
|
||||||
// Definitions =========================================================================================================
|
// Definitions =========================================================================================================
|
||||||
|
|
||||||
@@ -52,8 +64,21 @@ public:
|
|||||||
|
|
||||||
///
|
///
|
||||||
/// \brief Default Constructor, initializes an identity matrix.
|
/// \brief Default Constructor, initializes an identity matrix.
|
||||||
node2d(size_t id, size_t scene, const string& name)
|
/// \details This is the default node2d constructor, for inheritance, use the typed constructor
|
||||||
: scene_node(name, id, scene)
|
node2d(fennec::scene* scn, size_t id, const string& name)
|
||||||
|
: scene_node(scn, id, name)
|
||||||
|
, _mobility(mobility_free)
|
||||||
|
, _position(0, 0)
|
||||||
|
, _scale(1, 1)
|
||||||
|
, _shear(0, 0)
|
||||||
|
, _rotation(0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Default Typed Constructor, initializes an identity matrix with proper typing for inheritance.
|
||||||
|
template<typename TypeT>
|
||||||
|
node2d(fennec::scene* scn, size_t id, const string& name, TypeT* type)
|
||||||
|
: scene_node(scn, id, name, type)
|
||||||
, _mobility(mobility_free)
|
, _mobility(mobility_free)
|
||||||
, _position(0, 0)
|
, _position(0, 0)
|
||||||
, _scale(1, 1)
|
, _scale(1, 1)
|
||||||
@@ -123,7 +148,7 @@ public:
|
|||||||
// Get parent
|
// Get parent
|
||||||
|
|
||||||
|
|
||||||
_recalculate();
|
|
||||||
|
|
||||||
|
|
||||||
// Propagate down
|
// Propagate down
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
#define FENNEC_CORE_SCENE_H
|
#define FENNEC_CORE_SCENE_H
|
||||||
|
|
||||||
#include <fennec/containers/rdtree.h>
|
#include <fennec/containers/rdtree.h>
|
||||||
#include <fennec/lang/typed.h>
|
#include <fennec/lang/strings/string.h>
|
||||||
#include <fennec/langproc/strings/string.h>
|
|
||||||
#include <fennec/scene/scene_node.h>
|
#include <fennec/scene/forward.h>
|
||||||
|
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
@@ -33,7 +33,7 @@ namespace fennec
|
|||||||
/// \details This structure only contains the names of nodes and defers storage for components to
|
/// \details This structure only contains the names of nodes and defers storage for components to
|
||||||
/// their respective systems. Simple components may be isolated, \see components.h for more info.
|
/// their respective systems. Simple components may be isolated, \see components.h for more info.
|
||||||
/// The hierarchy should be displayed using pre-order traversal.
|
/// The hierarchy should be displayed using pre-order traversal.
|
||||||
class scene : public rdtree<scene_node*> {
|
class scene : private rdtree<scene_node*> {
|
||||||
|
|
||||||
// Access ==============================================================================================================
|
// Access ==============================================================================================================
|
||||||
public:
|
public:
|
||||||
@@ -42,44 +42,16 @@ public:
|
|||||||
/// \details If multiple nodes have the same name, finds the first one in pre-order traversal.
|
/// \details If multiple nodes have the same name, finds the first one in pre-order traversal.
|
||||||
/// \param name The name of the node to search for
|
/// \param name The name of the node to search for
|
||||||
/// \returns The id of the node, `npos` if not found.
|
/// \returns The id of the node, `npos` if not found.
|
||||||
size_t operator[](const cstring& name) const {
|
scene_node* operator[](const cstring& name) const;
|
||||||
list<size_t> parse;
|
|
||||||
parse.push_back(root);
|
|
||||||
while (not parse.empty()) {
|
|
||||||
size_t n = parse.front();
|
|
||||||
if (_table[n].value->name == name) {
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pre-Order traversal
|
|
||||||
parse.push_front(next(n));
|
|
||||||
parse.push_front(child(n));
|
|
||||||
parse.pop_front();
|
|
||||||
}
|
|
||||||
return npos;
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \brief Find a node by name.
|
/// \brief Find a node by name.
|
||||||
/// \details If multiple nodes have the same name, finds the first one in pre-order traversal.
|
/// \details If multiple nodes have the same name, finds the first one in pre-order traversal.
|
||||||
/// \param name The name of the node to search for
|
/// \param name The name of the node to search for
|
||||||
/// \returns The id of the node, `npos` if not found.
|
/// \returns The id of the node, `npos` if not found.
|
||||||
size_t operator[](const string& name) const {
|
scene_node* operator[](const string& name) const;
|
||||||
list<size_t> parse;
|
|
||||||
parse.push_back(root);
|
|
||||||
while (not parse.empty()) {
|
|
||||||
size_t n = parse.front();
|
|
||||||
if (_table[n].value->name == name) {
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pre-Order traversal
|
|
||||||
parse.push_front(next(n));
|
|
||||||
parse.push_front(child(n));
|
|
||||||
parse.pop_front();
|
|
||||||
}
|
|
||||||
return npos;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,51 +31,32 @@
|
|||||||
#ifndef FENNEC_SCENE_NODE_H
|
#ifndef FENNEC_SCENE_NODE_H
|
||||||
#define FENNEC_SCENE_NODE_H
|
#define FENNEC_SCENE_NODE_H
|
||||||
|
|
||||||
#include <fennec/lang/typed.h>
|
#include <fennec/lang/strings/string.h>
|
||||||
#include <fennec/langproc/strings/string.h>
|
|
||||||
#include <fennec/scene/component.h>
|
|
||||||
|
|
||||||
#include <utility>
|
#include <fennec/scene/scene.h>
|
||||||
|
#include <fennec/scene/component.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|
||||||
struct scene_node_ref {
|
struct scene_node {
|
||||||
size_t scene;
|
|
||||||
size_t id;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct scene_node : typed<scene_node> {
|
|
||||||
|
|
||||||
// Public Members ======================================================================================================
|
// Public Members ======================================================================================================
|
||||||
public:
|
public:
|
||||||
union {
|
scene* const scene;
|
||||||
struct {
|
const size_t id;
|
||||||
const size_t scene;
|
|
||||||
const size_t id;
|
|
||||||
};
|
|
||||||
const scene_node_ref ref;
|
|
||||||
};
|
|
||||||
string name;
|
string name;
|
||||||
|
|
||||||
scene_node(size_t scene, size_t id, string name)
|
scene_node(fennec::scene* scn, size_t id, const string& name)
|
||||||
: scene(scene), id(id), name(std::move(name)) {
|
: scene(scn), id(id)
|
||||||
}
|
, name(fennec::move(name)) {
|
||||||
|
|
||||||
template<typename ComponentT>
|
|
||||||
component* add_component() {
|
|
||||||
_components.push_back(component::create<ComponentT>(scene, id));
|
|
||||||
return _components.back();
|
|
||||||
}
|
|
||||||
|
|
||||||
component* add_component(uint64_t type) {
|
|
||||||
_components.push_back(component::create(type, scene, id));
|
|
||||||
return _components.back();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
dynarray<component*> _components;
|
dynarray<component*> _components;
|
||||||
|
|
||||||
|
FENNEC_RTTI_ENABLE();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,17 @@ set(CMAKE_CXX_STANDARD 23)
|
|||||||
|
|
||||||
add_executable(fennec-metaprogramming main.cpp
|
add_executable(fennec-metaprogramming main.cpp
|
||||||
float.h
|
float.h
|
||||||
integer.h)
|
integer.h
|
||||||
|
type_name.h)
|
||||||
|
|
||||||
|
target_compile_definitions(fennec-metaprogramming PUBLIC
|
||||||
|
${FENNEC_COMPILE_DEFINITIONS}
|
||||||
|
)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT .metaprogramming
|
OUTPUT .metaprogramming
|
||||||
COMMAND fennec-metaprogramming
|
COMMAND fennec-metaprogramming
|
||||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/../include/fennec/lang"
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/../include/"
|
||||||
COMMENT "Generating intrinsics"
|
COMMENT "Generating intrinsics"
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
inline void float_h()
|
inline void float_h()
|
||||||
{
|
{
|
||||||
std::ofstream out("float.h");
|
std::ofstream out("fennec/langcpp/float.h");
|
||||||
|
|
||||||
out << "// =====================================================================================================================" << std::endl;
|
out << "// =====================================================================================================================" << std::endl;
|
||||||
out << "// fennec, a free and open source game engine" << std::endl;
|
out << "// fennec, a free and open source game engine" << std::endl;
|
||||||
@@ -64,7 +64,7 @@ inline void float_h()
|
|||||||
|
|
||||||
out << "" << std::endl;
|
out << "" << std::endl;
|
||||||
|
|
||||||
out << "#include <fennec/lang/bits.h>" << std::endl;
|
out << "#include <fennec/langcpp/bits.h>" << std::endl;
|
||||||
|
|
||||||
out << "" << std::endl;
|
out << "" << std::endl;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
inline void integer_h()
|
inline void integer_h()
|
||||||
{
|
{
|
||||||
|
|
||||||
std::ofstream out("integer.h");
|
std::ofstream out("fennec/langcpp/integer.h");
|
||||||
|
|
||||||
out << "// =====================================================================================================================" << std::endl;
|
out << "// =====================================================================================================================" << std::endl;
|
||||||
out << "// fennec, a free and open source game engine" << std::endl;
|
out << "// fennec, a free and open source game engine" << std::endl;
|
||||||
|
|||||||
@@ -21,9 +21,11 @@
|
|||||||
|
|
||||||
#include "float.h"
|
#include "float.h"
|
||||||
#include "integer.h"
|
#include "integer.h"
|
||||||
|
#include "type_name.h"
|
||||||
|
|
||||||
int main(int, const char**)
|
int main(int, const char**)
|
||||||
{
|
{
|
||||||
float_h();
|
float_h();
|
||||||
integer_h();
|
integer_h();
|
||||||
|
type_name_h();
|
||||||
}
|
}
|
||||||
|
|||||||
107
metaprogramming/type_name.h
Normal file
107
metaprogramming/type_name.h
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// 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 type_name.h
|
||||||
|
/// \brief
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \details
|
||||||
|
/// \author Medusa Slockbower
|
||||||
|
///
|
||||||
|
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
#ifndef FENNEC_METAPROGRAMMING_TYPE_NAME_H
|
||||||
|
#define FENNEC_METAPROGRAMMING_TYPE_NAME_H
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
namespace fennec::detail
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline static const char* f() {
|
||||||
|
return __PRETTY_FUNCTION__;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void type_name_h()
|
||||||
|
{
|
||||||
|
|
||||||
|
std::ofstream out("fennec/rtti/detail/_constants.h");
|
||||||
|
|
||||||
|
out << "// =====================================================================================================================" << std::endl;
|
||||||
|
out << "// fennec, a free and open source game engine" << std::endl;
|
||||||
|
out << "// Copyright © 2025 Medusa Slockbower" << std::endl;
|
||||||
|
out << "//" << std::endl;
|
||||||
|
out << "// This program is free software: you can redistribute it and/or modify" << std::endl;
|
||||||
|
out << "// it under the terms of the GNU General Public License as published by" << std::endl;
|
||||||
|
out << "// the Free Software Foundation, either version 3 of the License, or" << std::endl;
|
||||||
|
out << "// (at your option) any later version." << std::endl;
|
||||||
|
out << "//" << std::endl;
|
||||||
|
out << "// This program is distributed in the hope that it will be useful," << std::endl;
|
||||||
|
out << "// but WITHOUT ANY WARRANTY; without even the implied warranty of" << std::endl;
|
||||||
|
out << "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" << std::endl;
|
||||||
|
out << "// GNU General Public License for more details." << std::endl;
|
||||||
|
out << "//" << std::endl;
|
||||||
|
out << "// You should have received a copy of the GNU General Public License" << std::endl;
|
||||||
|
out << "// along with this program. If not, see <https://www.gnu.org/licenses/>." << std::endl;
|
||||||
|
out << "// =====================================================================================================================" << std::endl;
|
||||||
|
|
||||||
|
out << "" << std::endl;
|
||||||
|
|
||||||
|
out << "#ifndef FENNEC_RTTI_DETAIL_CONSTANTS_H" << std::endl;
|
||||||
|
out << "#define FENNEC_RTTI_DETAIL_CONSTANTS_H" << std::endl;
|
||||||
|
|
||||||
|
out << "" << std::endl;
|
||||||
|
|
||||||
|
out << "#include <fennec/langcpp/types.h>" << std::endl;
|
||||||
|
|
||||||
|
out << "" << std::endl;
|
||||||
|
|
||||||
|
out << "namespace fennec::detail" << std::endl;
|
||||||
|
out << "{" << std::endl;
|
||||||
|
out << "" << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
std::string str = fennec::detail::f<void>();
|
||||||
|
size_t heading = str.find("void");
|
||||||
|
size_t footing = str.size() - (heading + 4);
|
||||||
|
|
||||||
|
out << "// " << str << std::endl;
|
||||||
|
out << "inline static constexpr size_t type_name_f_heading = " << heading << ";" << std::endl;
|
||||||
|
out << "inline static constexpr size_t type_name_f_footing = " << footing << ";" << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
out << "" << std::endl;
|
||||||
|
out << "}" << std::endl;
|
||||||
|
|
||||||
|
out << "" << std::endl;
|
||||||
|
|
||||||
|
out << "#endif // FENNEC_RTTI_DETAIL_CONSTANTS_H" << std::endl;
|
||||||
|
|
||||||
|
out.close();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // FENNEC_METAPROGRAMMING_TYPE_NAME_H
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
* [Introduction](#introduction)
|
* [Introduction](#introduction)
|
||||||
* [Definitions](#definitions)
|
* [Definitions](#definitions)
|
||||||
* [Libraries](#libraries)
|
* [Libraries](#libraries)
|
||||||
* [C++ Language Library](./CPP_LANGUAGE.md#c-language-library-lang)
|
* [C++ Language Library](./CPP_LANGUAGE.md#c-language-library-langcpp)
|
||||||
* [Platform Support Library](./PLATFORM_SUPPORT.md#platform-support-library-platform)
|
* [Platform Support Library](./PLATFORM_SUPPORT.md#platform-support-library-platform)
|
||||||
<!-- TOC -->
|
<!-- TOC -->
|
||||||
|
|
||||||
@@ -71,8 +71,8 @@ denote implementation and testing progress. The symbols are defined below.
|
|||||||
|
|
||||||
|
|
||||||
## Libraries
|
## Libraries
|
||||||
- [C++ Language Library](./CPP_LANGUAGE.md#c-language-library-lang)
|
- [C++ Language Library](./CPP_LANGUAGE.md#c-language-library-langcpp)
|
||||||
- [Platform Support Library](./PLATFORM_SUPPORT.md#platform-support-library-platform)
|
- [Platform Support Library](./PLATFORM_SUPPORT.md#platform-support-library-platform)
|
||||||
- [Memory Library](./MEMORY.md#memory-library-memory)
|
- [Memory Library](./MEMORY.md#memory-library-memory)
|
||||||
- [Containers Library](./CONTAINERS.md#containers-library-containers)
|
- [Containers Library](./CONTAINERS.md#containers-library-containers)
|
||||||
- [Language Processing Library](./LANGUAGE_PROCESSING.md#language-processing-library-langproc)
|
- [Language Processing Library](./LANGUAGE_PROCESSING.md#language-processing-library-lang)
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
<!-- I release these notes into the public domain -->
|
<!-- I release these notes into the public domain -->
|
||||||
|
|
||||||
# C++ Language Library (`lang`)
|
# C++ Language Library (`langcpp`)
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
<!-- TOC -->
|
<!-- TOC -->
|
||||||
* [Home](./CONTENTS.md#planning-documentation-for-fennec)
|
* [Home](./CONTENTS.md#planning-documentation-for-fennec)
|
||||||
* [C++ Language Library](#c-language-library-lang)
|
* [C++ Language Library](#c-language-library-langcpp)
|
||||||
* [Table of Contents](#table-of-contents)
|
* [Table of Contents](#table-of-contents)
|
||||||
* [Introduction](#introduction)
|
* [Introduction](#introduction)
|
||||||
* [Implementation](#implementation)
|
* [Implementation](#implementation)
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
|
|
||||||
<!-- I release these notes into the public domain -->
|
<!-- I release these notes into the public domain -->
|
||||||
|
|
||||||
# Language Processing Library (`langproc`)
|
# Language Processing Library (`lang`)
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
<!-- TOC -->
|
<!-- TOC -->
|
||||||
* [Home](./CONTENTS.md#planning-documentation-for-fennec)
|
* [Home](./CONTENTS.md#planning-documentation-for-fennec)
|
||||||
* [Language Processing Library (`langproc`)](#language-processing-library-langproc)
|
* [Language Processing Library (`lang`)](#language-processing-library-lang)
|
||||||
* [Table of Contents](#table-of-contents)
|
* [Table of Contents](#table-of-contents)
|
||||||
* [Introduction](#introduction)
|
* [Introduction](#introduction)
|
||||||
* [String Analysis (`langproc/strings`)](#string-analysis-langprocstrings)
|
* [String Analysis (`lang/strings`)](#string-analysis-langprocstrings)
|
||||||
* [Implementation](#implementation)
|
* [Implementation](#implementation)
|
||||||
* [File System (`filesystem`)](#file-system-filesystem)
|
* [File System (`filesystem`)](#file-system-filesystem)
|
||||||
* [Implementation](#implementation-1)
|
* [Implementation](#implementation-1)
|
||||||
@@ -27,7 +27,7 @@ and programming languages.
|
|||||||
this is through Doxygen and LaTeX. Consider including binaries with releases.
|
this is through Doxygen and LaTeX. Consider including binaries with releases.
|
||||||
|
|
||||||
|
|
||||||
## String Analysis (`langproc/strings`)
|
## String Analysis (`lang/strings`)
|
||||||
|
|
||||||
  fennec reimplements the C++ Strings Library as a submodule of this library. This
|
  fennec reimplements the C++ Strings Library as a submodule of this library. This
|
||||||
is because C++ `std::string` has a lot of overhead. I would say that `std::string`
|
is because C++ `std::string` has a lot of overhead. I would say that `std::string`
|
||||||
@@ -61,7 +61,7 @@ is create C++ classes that handle file streams, directory streams, and file path
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Interpreter (`langproc/parse`)
|
## Interpreter (`lang/parse`)
|
||||||
|
|
||||||
  This submodule will contain classes for parsing data. We will need to be
|
  This submodule will contain classes for parsing data. We will need to be
|
||||||
able to do the following things to achieve support for files that adhere to a
|
able to do the following things to achieve support for files that adhere to a
|
||||||
@@ -96,7 +96,7 @@ data values (e.g. floats, ints, etc.) to a readable language (e.g. ascii/utf8/ut
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Formats (`langproc/formats`)
|
## Formats (`lang/formats`)
|
||||||
|
|
||||||
  This submodule will contain classes for processing a variety of file formats.
|
  This submodule will contain classes for processing a variety of file formats.
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user