areBindable

Returns true if two property descriptors are bindable. To be bindable, the property name must be identical but also their types. Type checking is based on RTTI and neither source nor target needs to be passed with the correct type.

bool
areBindable
(
S
T
)
in { assert (source); assert (target); assert (cast(void*)target != cast(void*)source); }

Examples

1 int a,b;
2 
3 // exact match
4 PropDescriptor!int aDescriptor = PropDescriptor!int(&a, "a");
5 PropDescriptor!int bDescriptor = PropDescriptor!int(&b, "a");
6 assert(areBindable(&aDescriptor, &bDescriptor));
7 
8 // it also works with different static types thanks to the RTTI
9 auto cDescriptor = cast(PropDescriptor!float*) &aDescriptor;
10 assert(areBindable(cDescriptor, &bDescriptor));

Meta