From: Andrei Alexandrescu \(See Website for Email\) (andrewalex_at_[hidden])
Date: 2004-07-06 21:56:16


Just sent the message below to clc++m. Any comments are welcome.

There's a library that I understand is being proposed for Boost:

http://www.codeproject.com/vcpp/stl/PGIL.asp

It does useful things, but it runs straight against the commonly given
advice (with which I happen to agree) that one should not override operator,
unless using expression templates that ensure left-to-right evaluation.

So now, in the referenced article, the author makes the comment: "
Overloading operator comma is sometimes viewed as a bad practice [3].
However, it has been done with success in eg. the Generative Matrix
Computation Library and Blitz to initialize matrices (see [4]) and [5]). The
Initialization Library overloads the comma operator in a safe manner by
letting set_cont and set_map return an object that is responsible for the
initialization. Therefore it takes explicit action from the programmer to
begin using the overloaded operator,(). "

I think the mentioned libraries do employ expression templates, while the
initialization library does not. So I am unsatisfied. Anyone here can soothe
my concerns? Is overloading the comma operator considered harmless after
all?

Andrei