On Sunday, 21 April 2019 at 18:07:08 UTC, Ferhat Kurtulmuş wrote:
I am writing an opencv binding and need something like: Mat m = another_mat > 5;

D does not support that. The comparison operators are always just true or false (as determined by the int opCmp or the bool opEquals returns), they do not return other types.

You will probably have to use a named method instead. You could kinda fake it with a string template arg:

Mat m = another_map.cmp!">"(5);

But I'd probably just do it

Mat m = another_map.is_greater_than(5);

which imo is more readable. but the implementations are the same - in both cases, your custom function.

Reply via email to