diff --git a/include/cppmp.h b/include/cppmp.h index 4f08f26..e0a0150 100644 --- a/include/cppmp.h +++ b/include/cppmp.h @@ -1,3 +1,5 @@ #pragma once -#include +#include "cppmp/core.h" +#include "cppmp/misc.h" +#include "cppmp/traits.h" diff --git a/include/cppmp/core.h b/include/cppmp/core.h new file mode 100644 index 0000000..28c9166 --- /dev/null +++ b/include/cppmp/core.h @@ -0,0 +1,7 @@ +#pragma once + +#include "core/checker.h" +#include "core/conditionals.h" +#include "core/constants.h" +#include "core/modifier.h" +#include "core/types.h" diff --git a/include/cppmp/core/checker.h b/include/cppmp/core/checker.h new file mode 100644 index 0000000..8325f87 --- /dev/null +++ b/include/cppmp/core/checker.h @@ -0,0 +1,133 @@ +#pragma once + +#define cppmp_define_checker(name) \ + template \ + struct name \ + : public integral_constant::value), std::name::value> \ + { }; \ + \ + template \ + constexpr decltype(auto) name ## _v = name::value; + +#include "types.h" + +namespace cppmp +{ + + /** + * @brief Evaluates to true_t if the passed template parameters are valid, false_t otherwise. + */ + template + struct is_valid; + + /** + * @brief Is true if the passed template parameters are valid, false otherwise. + */ + template + constexpr decltype(auto) is_valid_v = is_valid::value; + + /** + * @brief Evaluates to true_t if T is a specialization if T_template, false_t otherwise. + */ + template class T_template> + struct is_specialization_of; + + /** + * @brief Evaluates to true if T is a specialization if T_template, false otherwise. + */ + template class T_template> + constexpr decltype(auto) is_specialization_of_v = is_specialization_of::value; + + /** + * @brief Evaluates to true_t if all passed parameters are true, false_t otherwise. + */ + template + struct is_true; + + /** + * @brief Evaluates to true if all passed parameters are true, false otherwise. + */ + template + constexpr decltype(auto) is_true_v = is_true::value; + + cppmp_define_checker(is_void); + cppmp_define_checker(is_null_pointer); + cppmp_define_checker(is_integral); + cppmp_define_checker(is_floating_point); + cppmp_define_checker(is_array); + cppmp_define_checker(is_enum); + cppmp_define_checker(is_union); + cppmp_define_checker(is_class); + cppmp_define_checker(is_function); + cppmp_define_checker(is_pointer); + cppmp_define_checker(is_lvalue_reference); + cppmp_define_checker(is_rvalue_reference); + cppmp_define_checker(is_member_object_pointer); + cppmp_define_checker(is_member_function_pointer); + cppmp_define_checker(is_fundamental); + cppmp_define_checker(is_arithmetic); + cppmp_define_checker(is_scalar); + cppmp_define_checker(is_object); + cppmp_define_checker(is_compound); + cppmp_define_checker(is_reference); + cppmp_define_checker(is_member_pointer); + cppmp_define_checker(is_const); + cppmp_define_checker(is_volatile); + cppmp_define_checker(is_trivial); + cppmp_define_checker(is_trivially_copyable); + cppmp_define_checker(is_standard_layout); + cppmp_define_checker(is_pod); + cppmp_define_checker(is_literal_type); + cppmp_define_checker(has_unique_object_representations); + cppmp_define_checker(is_empty); + cppmp_define_checker(is_polymorphic); + cppmp_define_checker(is_abstract); + cppmp_define_checker(is_final); + cppmp_define_checker(is_aggregate); + cppmp_define_checker(is_signed); + cppmp_define_checker(is_unsigned); + cppmp_define_checker(is_constructible); + cppmp_define_checker(is_trivially_constructible); + cppmp_define_checker(is_nothrow_constructible); + cppmp_define_checker(is_default_constructible); + cppmp_define_checker(is_trivially_default_constructible); + cppmp_define_checker(is_nothrow_default_constructible); + cppmp_define_checker(is_copy_constructible); + cppmp_define_checker(is_trivially_copy_constructible); + cppmp_define_checker(is_nothrow_copy_constructible); + cppmp_define_checker(is_move_constructible); + cppmp_define_checker(is_trivially_move_constructible); + cppmp_define_checker(is_nothrow_move_constructible); + cppmp_define_checker(is_assignable); + cppmp_define_checker(is_trivially_assignable); + cppmp_define_checker(is_nothrow_assignable); + cppmp_define_checker(is_copy_assignable); + cppmp_define_checker(is_trivially_copy_assignable); + cppmp_define_checker(is_nothrow_copy_assignable); + cppmp_define_checker(is_move_assignable); + cppmp_define_checker(is_trivially_move_assignable); + cppmp_define_checker(is_nothrow_move_assignable); + cppmp_define_checker(is_destructible); + cppmp_define_checker(is_trivially_destructible); + cppmp_define_checker(is_nothrow_destructible); + cppmp_define_checker(has_virtual_destructor); + cppmp_define_checker(is_swappable_with); + cppmp_define_checker(is_swappable); + cppmp_define_checker(is_nothrow_swappable_with); + cppmp_define_checker(is_nothrow_swappable); + cppmp_define_checker(alignment_of); + cppmp_define_checker(rank); + cppmp_define_checker(extent); + cppmp_define_checker(is_same); + cppmp_define_checker(is_base_of); + cppmp_define_checker(is_convertible); + cppmp_define_checker(is_invocable); + cppmp_define_checker(is_invocable_r); + cppmp_define_checker(is_nothrow_invocable); + cppmp_define_checker(is_nothrow_invocable_r); + +} + +#undef cppmp_define_checker + +#include "checker.inl" diff --git a/include/cppmp/core/checker.inl b/include/cppmp/core/checker.inl new file mode 100644 index 0000000..08f84d4 --- /dev/null +++ b/include/cppmp/core/checker.inl @@ -0,0 +1,51 @@ +#pragma once + +#include "checker.h" + +namespace cppmp +{ + + namespace __impl + { + + /* bool_pack */ + + template + struct bool_pack; + + /* is_specialization_of_impl */ + + template class T_template> + struct is_specialization_of_impl + : public false_t + { }; + + template