Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-10-29 11:03:01


From: "George A. Heintzelman" <georgeh_at_[hidden]>
[...]
> > > Is there anything I (or boost) can do?<
> >
> > Yes, you can rename type() to something less collision prone. Functions
that
> > are intended to be used via argument dependent lookup must have
distinctive
> > names. "iterator_type" would be better, but probably not enough; use
> > something more descriptive.
>
> I don't like this answer.

You are not alone.

> I understood that the idea of Koenig lookup
> was to allow me to use those kinds of short names without having to say
> myprefix_shortname(iterator) every time.

No, the idea of Koenig lookup is to let unqualified calls work. It doesn't
allow shorter names.

When you introduce a function 'type' that is intended to take advantage of
ADL, you are effectively claiming ownership on the name 'type' in all
reachable namespaces. You could argue that those reachable namespaces should
change to not include 'type', but the typical approach is to fix the problem
on your end.

> In my case in particular, I am
> replacing pointers with a new iterator type where we had functions
> type(Record *) now getting replaced by type(Iterator), and type() isn't
> the only name involved (I'd have to rename all the others for
> consistency), so it's not a feasible solution for me.

Qualified calls?


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