How to create a custom max() function without the ambiguity error.
realhet
real_het at hotmail.com
Fri Dec 6 12:34:17 UTC 2019
Hi,
I'm trying to use a popular function name "max", and extend it
for my special types:
For example:
module utils;
MyType max(in MyType a, in MyType a){...} //static function
struct V3f{
V3f max(in V2f b){...} //member function
}
module gl3n;
vec3 max(in vec3 a, in vec3 a) //another static function in
different module
I also want to use std.algorithm.comparison.max as well.
I know that the ambiguity error can be avoided by public
importing all the various max implementations into one place, but
how to do this when I want to use 3 modules? Need a 4th module to
combine them all? Is there a nicer way?
Another question that is it possible to extend the the template
function "to" in more than one module and use it easily from my
main project modules?
More information about the Digitalmars-d-learn
mailing list