Re: How to create a custom max() function without the ambiguity error.

2019-12-06 Thread Mike Parker via Digitalmars-d-learn
On Friday, 6 December 2019 at 21:02:53 UTC, realhet wrote: Here's my latest attempt on EXTENDING std.algorithm.max's functionality with a max operation on a custom type. The type is the GLSL vec2 type which does the max operation component-wise. The D std implementation uses the < operator,

Re: How to create a custom max() function without the ambiguity error.

2019-12-06 Thread realhet via Digitalmars-d-learn
On Friday, 6 December 2019 at 14:55:18 UTC, Ferhat Kurtulmuş wrote: On Friday, 6 December 2019 at 13:25:24 UTC, realhet wrote: On Friday, 6 December 2019 at 13:04:57 UTC, Ferhat Kurtulmuş wrote: [...] Thx for answering! [...] In d you can also use scoped imports:

Re: How to create a custom max() function without the ambiguity error.

2019-12-06 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 6 December 2019 at 13:25:24 UTC, realhet wrote: On Friday, 6 December 2019 at 13:04:57 UTC, Ferhat Kurtulmuş wrote: [...] Thx for answering! [...] In d you can also use scoped imports: https://dlang.org/spec/module.html#scoped_imports

Re: How to create a custom max() function without the ambiguity error.

2019-12-06 Thread Andrea Fontana via Digitalmars-d-learn
On Friday, 6 December 2019 at 12:34:17 UTC, realhet wrote: 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

Re: How to create a custom max() function without the ambiguity error.

2019-12-06 Thread realhet via Digitalmars-d-learn
On Friday, 6 December 2019 at 13:04:57 UTC, Ferhat Kurtulmuş wrote: On Friday, 6 December 2019 at 12:34:17 UTC, realhet wrote: 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){...}

Re: How to create a custom max() function without the ambiguity error.

2019-12-06 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 6 December 2019 at 12:34:17 UTC, realhet wrote: 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

How to create a custom max() function without the ambiguity error.

2019-12-06 Thread realhet via Digitalmars-d-learn
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