expr
expr copied to clipboard
Arithmetic operator override
Hi.
Such a cool project, bravo!
I wrote a small test app using the '+' operator over arrays of integers and arrays of floats. Since I could not use the '+' operator, I implemented a short 'add' function to test this feature and it works.
To build this feature in expr and override the '+' (and other arithmetic operators), where would be the good place to experiment in the source code?
Experimentation stage for now. Happy to share a pull-request if something good comes out of this experiment.
Cheers.
Did you read this? https://github.com/antonmedv/expr/blob/master/docs/Operator-Override.md
ok, thanks! I totally missed this section in the documentation.
expr.Operator("-", "Sub"), // Override `-` with function `Sub`.
If there are multiple types, all ints and floats variants, is it possible to duplicate the above call multiple times with their respective callback function?
Didn’t got what you mean.