4 ms·
I can't say I'm 100% happy with the slicing notation. I played around with some other wacky things, but then settled on overloading operator() to get a concise
by syvex 12y ago
I can't say I'm 100% happy with the slicing notation. I played around with some other wacky things, but then settled on overloading operator() to get a concise syntax.
In principle, you use it similar to python--s(5,10) instead of s[5:10].
I would have maybe liked to end up with s[5,10], but the only way to overload operator[] like that is with a pair. Then you'd end up with s[{5,10}]. So I figured it would be best to stick with just s(5,10).
- thegeomaster 12y agoNot relevant in this case, but you may find this interesting (assuming you haven't seen it already): https://github.com/klmr/named-operator https://github.com/klmr/named-operator.