Boost logo

Boost :

From: Gabriel Dos Reis (dosreis_at_[hidden])
Date: 1999-12-09 00:51:05


jsiek_at_[hidden] writes:

| Gabriel Dos Reis writes:
| >
| > Althought I agree with DK, I think the fact that operator[]() should
| > be a member function isn't really a big constraint, assuming I didn't
| > miss anything :-) Since you plan to use proxies, what about making
| > operator[]() a template member function and forward the actual
| > operation to be done to a global function?
|
| With the member function you have to apply some wrapper at the call
| site (of the graph algorithm)

I understand that,

| ... if the operator is not already provided
| by whatever you are using for property storage.

?? If the operator is not provided, then you get a compile-time error,
as you do with a global function. Actually the error happens in the
global function you forward operations to.
But as I said in my earlier message, I'm in agreement with DK's
viewpoint. Member function are too special to be generic :-)

| ... With the global
| function, no wrapping is needed at the call site, just overload the
| function once and for all.

With what I proposed you get both operator[]() and global functions.

-- Gaby


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk