diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-06 13:30:17 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-06 13:37:15 +0200 |
commit | 3534cd206bedef5ea75302d9abf879b15d1df89c (patch) | |
tree | 977f646ae1282ff7f539d2a524d1e354bfcf465d /compat | |
parent | 4d6f747c4b8287e042363264a47265848ca2d92c (diff) |
test: speed up compile time
Removes implicit includes to <windows.h> and <cr/StringView.h> from all
files.
Goes from 30 to 20 seconds.
Diffstat (limited to 'compat')
-rw-r--r-- | compat/array-size.hpp | 19 | ||||
-rw-r--r-- | compat/function2.hpp | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/compat/array-size.hpp b/compat/array-size.hpp new file mode 100644 index 00000000..ca545898 --- /dev/null +++ b/compat/array-size.hpp @@ -0,0 +1,19 @@ +#pragma once +#include <array> + +namespace floormat::detail { + +template<typename T> struct array_size_; // todo! replace usages of arraySize & std::size +template<typename T, size_t N> struct array_size_<T(&)[N]> : std::integral_constant<size_t, N> {}; +template<typename T, size_t N> struct array_size_<T[N]> : std::integral_constant<size_t, N> {}; +template<typename T, size_t N> struct array_size_<std::array<T, N>> : std::integral_constant<size_t, N> {}; +template<typename T, size_t N> struct array_size_<StaticArray<N, T>> : std::integral_constant<size_t, N> {}; + +} // namespace floormat::detail + +namespace floormat { + +template<typename T> constexpr inline size_t static_array_size = detail::array_size_<T>::value; +template<typename T> constexpr inline size_t array_size(const T&) noexcept { return detail::array_size_<T>::value; } + +} // namespace floormat diff --git a/compat/function2.hpp b/compat/function2.hpp index cd23bad9..54f00111 100644 --- a/compat/function2.hpp +++ b/compat/function2.hpp @@ -17,7 +17,7 @@ #define FU2_WITH_NO_FUNCTIONAL_HEADER #include <cassert> #include <cstddef> -//#include <cstdlib> +#include <cstdlib> #include <memory> #include <tuple> #include <type_traits> |