On Mon, 03 Oct 2011 16:07:19 -0400, Andrej Mitrovic
<andrej.mitrov...@gmail.com> wrote:
On 10/3/11, Steven Schveighoffer <schvei...@yahoo.com> wrote:
Probably slightly off topic, but be very careful with operator overloads
without using constraints.
For example, I can do some weird things to your struct:
Point p;
p.opOpAssign!"*x; y+="(5);
I suspect operator overloads are going to be a large hole in the
interface
design of many objects, but at least they won't be exploitable once
compiled.
-Steve
Generally when I post examples I won't add any constraints, this is to
make it easier for other people to read the code. All of the ops have
constraints in my code.
Even so, it's better for people who are not familiar with the language to
see correct code vs. code open to exploitation.
I've argued in the past that we need some boilerplate constraints for
operators (like isValidOpString). Can't remember where that stands.
-Steve