Util: Use C++20 concepts for integral and floating-point types
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user