morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::detail::ConstantConvertible Concept Reference

Whether From may become a constant Prop<To>: an implicit conversion that does not silently change the kind of value. More...

#include <view.hpp>

Concept definition

template<typename From, typename To>
concept ConstantConvertible = std::convertible_to<From, To> &&
!(std::is_same_v<std::remove_cv_t<To>, bool> && std::is_pointer_v<std::decay_t<From>>) &&
!(std::is_integral_v<To> && std::is_floating_point_v<std::remove_cvref_t<From>>) &&
Whether From may become a constant Prop<To>: an implicit conversion that does not silently change the...
Definition view.hpp:89
Whether a type is a SlotBinding: false here, true for the specialisation below.
Definition view.hpp:72

Detailed Description

Whether From may become a constant Prop<To>: an implicit conversion that does not silently change the kind of value.

Two implicit conversions are refused because they compile and then show something else. A pointer, a string literal included, converts to bool as "not null", so Prop<bool>{"false"} would be true. A floating-point value converts to an integral type by truncation, so Prop<std::int64_t>{2.9} would be 2. Other narrowing, such as int to std::size_t, is kept: Prop<std::size_t> count = 0 is the ordinary way to write a count.

From is the source type as deduced for a forwarding reference; To is the property's value type.

Definition at line 89 of file view.hpp.