Util: Use C++20 concepts for integral and floating-point types

This commit is contained in:
Riyyi
2022-08-04 16:05:49 +02:00
parent 7cff165f08
commit 9758c3e425
5 changed files with 62 additions and 89 deletions
+22
View File
@@ -0,0 +1,22 @@
/*
* Copyright (C) 2022 Riyyi
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <type_traits> // is_integral_v, floating_point_v
namespace Util::Concepts {
template<class T>
concept Integral = std::is_integral_v<T>;
template<typename T>
concept FloatingPoint = std::is_floating_point_v<T>;
} // namespace Util::Concepts
using Util::Concepts::FloatingPoint;
using Util::Concepts::Integral;