wuzp
Wrong Unit? Zero Points! Compile-time checks for units, coordinate systems and points vs. vectors.
Loading...
Searching...
No Matches
Unit.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <type_traits>
4
6
7namespace wuzp {
8
9template <typename ImplementationT_>
10struct Unit {
11 using ImplementationT = ImplementationT_;
12};
13
14// The sum and the difference of quantities only exist if their units match. Every units backend gives equal units the same type
15// (see UnitSystem in concepts.hpp), so the core compares them by their types, for every units backend.
16template <typename ImplementationLhsT_, typename ImplementationRhsT_>
17struct Sum<Unit<ImplementationLhsT_>, Unit<ImplementationRhsT_>> {
18 static_assert(std::is_same_v<ImplementationLhsT_, ImplementationRhsT_>, "Units do not match.");
20};
21
22template <typename ImplementationLhsT_, typename ImplementationRhsT_>
23struct Difference<Unit<ImplementationLhsT_>, Unit<ImplementationRhsT_>> {
24 static_assert(std::is_same_v<ImplementationLhsT_, ImplementationRhsT_>, "Units do not match.");
26};
27
28} // namespace wuzp
ImplementationT_ ImplementationT
Definition Unit.hpp:11