mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 20:34:26 +02:00
feat: TagType concept added
This commit is contained in:
@@ -207,4 +207,11 @@ template<template<auto...> typename T, typename T1, typename T2, typename... Ts>
|
|||||||
return get<T, T2, Ts...>();
|
return get<T, T2, Ts...>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
concept TagType = std::is_empty_v<T> && std::is_final_v<T>;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mp_units
|
} // namespace mp_units
|
||||||
|
@@ -42,7 +42,7 @@ struct dimension_interface;
|
|||||||
* Satisfied by all dimension types in the library.
|
* Satisfied by all dimension types in the library.
|
||||||
*/
|
*/
|
||||||
MP_UNITS_EXPORT template<typename T>
|
MP_UNITS_EXPORT template<typename T>
|
||||||
concept Dimension = std::derived_from<T, detail::dimension_interface> && std::is_empty_v<T> && std::is_final_v<T>;
|
concept Dimension = detail::TagType<T> && std::derived_from<T, detail::dimension_interface>;
|
||||||
|
|
||||||
MP_UNITS_EXPORT template<symbol_text Symbol>
|
MP_UNITS_EXPORT template<symbol_text Symbol>
|
||||||
struct base_dimension;
|
struct base_dimension;
|
||||||
|
@@ -65,7 +65,7 @@ struct point_origin_interface;
|
|||||||
* Satisfied by either quantity points or by all types derived from `absolute_point_origin` class template.
|
* Satisfied by either quantity points or by all types derived from `absolute_point_origin` class template.
|
||||||
*/
|
*/
|
||||||
MP_UNITS_EXPORT template<typename T>
|
MP_UNITS_EXPORT template<typename T>
|
||||||
concept PointOrigin = std::derived_from<T, detail::point_origin_interface> && std::is_empty_v<T> && std::is_final_v<T>;
|
concept PointOrigin = detail::TagType<T> && std::derived_from<T, detail::point_origin_interface>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A concept matching all quantity point origins for a specified quantity type in the library
|
* @brief A concept matching all quantity point origins for a specified quantity type in the library
|
||||||
|
@@ -37,8 +37,7 @@ struct quantity_spec_interface_base;
|
|||||||
}
|
}
|
||||||
|
|
||||||
MP_UNITS_EXPORT template<typename T>
|
MP_UNITS_EXPORT template<typename T>
|
||||||
concept QuantitySpec =
|
concept QuantitySpec = detail::TagType<T> && std::derived_from<T, detail::quantity_spec_interface_base>;
|
||||||
std::derived_from<T, detail::quantity_spec_interface_base> && std::is_empty_v<T> && std::is_final_v<T>;
|
|
||||||
|
|
||||||
MP_UNITS_EXPORT
|
MP_UNITS_EXPORT
|
||||||
#if MP_UNITS_API_NO_CRTP
|
#if MP_UNITS_API_NO_CRTP
|
||||||
|
@@ -43,7 +43,7 @@ struct unit_interface;
|
|||||||
* Satisfied by all unit types provided by the library.
|
* Satisfied by all unit types provided by the library.
|
||||||
*/
|
*/
|
||||||
MP_UNITS_EXPORT template<typename T>
|
MP_UNITS_EXPORT template<typename T>
|
||||||
concept Unit = std::derived_from<T, detail::unit_interface> && std::is_empty_v<T> && std::is_final_v<T>;
|
concept Unit = detail::TagType<T> && std::derived_from<T, detail::unit_interface>;
|
||||||
|
|
||||||
template<Magnitude auto M, Unit U>
|
template<Magnitude auto M, Unit U>
|
||||||
requires(M != magnitude<>{} && M != mag<1>)
|
requires(M != magnitude<>{} && M != mag<1>)
|
||||||
|
Reference in New Issue
Block a user