This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] Qualify standard functions with std:: in stl_algo.h
Nathan Myers <ncm-nospam@cantrip.org> writes:
| On Sun, Jun 29, 2003 at 11:31:58PM +0200, Gabriel Dos Reis wrote:
| > | ! return __unique_copy(__first, __last, __result, __binary_pred, _IterType());
| >
| > This should also be qualified -- even though the identifier is in the
| > implementor namespace.
|
| I don't agree that this is necessary.
The issue to understand is that qualified and unqualified name don't
forgo the same name lookup rules, in templates. We ought to be clear
whether internally used functions are looked up at the point of
definition or not. The patch is going in that direction (except for
the point of curtomzsation functions). Therefore, even __xyz ought to
be qualified.
| > | ! std::swap(*__first++, *__first2++);
| >
| > This swap needs not be qualified.
| >
| > swap has sort of become to have an operator-like status: It is
| > regarded as a fundamental operator. In the EWG, we're exploring the
| > notion of "regular types", and swap is considered one of the
| > fundamental operations on those type. We need to have them work
| > through ADL.
|
| I don't agree.
You're welcome. But your opinion does nto reflect what the EWG and
other of the LWG think about swap. Not just because swap is defined
in std:: means it cannot be point of customization or that it cannot
be an operator. Actually, the majority of the papers related to
internally used names in implementations treats swap differently, like
an operator.
| The standard swap() is in std::, and that's the one we
| want to call. Herb Sutter would argue otherwise, but he also argues
| otherwise about every other algorithm that users are encouraged to
| specialize.
|
| Users are certainly allowed to declare a global swap, but if they
You're missing the point. It is not about declaring a global swap --
because doing so just doesn't solve anything useful. The way to have
swap work properly is to use ADL, i.e. unqualfied call.
Oh, and I'm not representing writings of Herb Sutter.
-- Gaby