diff --git a/example/custom_systems.cpp b/example/custom_systems.cpp index f8fa8a3b..f3264aed 100644 --- a/example/custom_systems.cpp +++ b/example/custom_systems.cpp @@ -65,11 +65,21 @@ using length = quantity; } // namespace fps } // namespace si +template +concept castable_to = Quantity && Unit && + requires (Q q) { + quantity_cast(q); + }; + void conversions() { - // constexpr auto fps_yard = fps::length(1.); - // std::cout << quantity_cast(fps_yard) << "\n"; + // fps::yard is not defined in terms of SI units (or vice-versa) + // so the conversion between FPS and SI is not possible + static_assert(!castable_to, si::kilometre>); + // si::fps::yard is defined in terms of SI units + // so the conversion between FPS and SI is possible + static_assert(castable_to, si::kilometre>); constexpr auto si_fps_yard = si::fps::length(1.); std::cout << quantity_cast(si_fps_yard) << "\n"; }