Add an example showing that it is not possible to add two quantities of different units.
The code like:
#include "../../CtUnits/CtUnits.hpp"
#include <iostream>
#include <type_traits>
int main()
{
struct Meter
{
};
struct Inch
{
};
using value_type = double;
using DistanceInMeters =
ctu::Quantity<value_type, ctu::UdMap<ctu::UnitDimension<Meter, 1>>>;
using DistanceInInches =
ctu::Quantity<value_type, ctu::UdMap<ctu::UnitDimension<Inch, 1>>>;
const auto dist_a = DistanceInInches(123.0);
const auto dist_b = DistanceInMeters(321.0);
std::cout << (dist_a + dist_b).get_value() << '\n';
return 0;
}
will not compile, because it tries to add meters to inches.
Add an example showing that it is not possible to add two quantities of different units.
The code like:
will not compile, because it tries to add meters to inches.