feat: tag types are now required to be empty

This commit is contained in:
Mateusz Pusz
2024-10-03 16:51:01 +02:00
parent 6f771e0ed7
commit 2c15f3c058
4 changed files with 5 additions and 4 deletions

View File

@@ -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_final_v<T>; concept Dimension = std::derived_from<T, detail::dimension_interface> && std::is_empty_v<T> && std::is_final_v<T>;
MP_UNITS_EXPORT template<symbol_text Symbol> MP_UNITS_EXPORT template<symbol_text Symbol>
struct base_dimension; struct base_dimension;

View File

@@ -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_final_v<T>; concept PointOrigin = std::derived_from<T, detail::point_origin_interface> && std::is_empty_v<T> && std::is_final_v<T>;
/** /**
* @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

View File

@@ -37,7 +37,8 @@ struct quantity_spec_interface_base;
} }
MP_UNITS_EXPORT template<typename T> MP_UNITS_EXPORT template<typename T>
concept QuantitySpec = std::derived_from<T, detail::quantity_spec_interface_base> && std::is_final_v<T>; concept QuantitySpec =
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

View File

@@ -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_final_v<T>; concept Unit = std::derived_from<T, detail::unit_interface> && std::is_empty_v<T> && std::is_final_v<T>;
template<Magnitude auto M, Unit U> template<Magnitude auto M, Unit U>
requires(M != magnitude<>{} && M != mag<1>) requires(M != magnitude<>{} && M != mag<1>)