Boost logo

Boost :

From: Jim.Hyslop (jim.hyslop_at_[hidden])
Date: 2001-10-18 13:04:24

Peter Dimov [SMTP:pdimov_at_[hidden]] wrote:
> While we are on the topic:
> The article
> asserts that any_cast will work unqualified due to Koenig lookup. However,
> note that it has an explicit template parameter. I'm not sure whether
> argument dependent lookup will work in this case.
The compiler I use doesn't support Koenig lookup, so I blush to admit it's
one of those things I haven't bothered learning all the details about (I
know the general idea, of course). My original code sample qualified the use
of any_cast, but Kevlin assured me Koenig lookup should work.

I'm not clear how you see that explicit template parameters will affect
Koenig lookup. I've checked the standard, and my reading of 3.4.2 supports
Kevlin's (and therefore my) position.

Let me explain my reasoning on why I think it should work:

The name being looked up is a template function named "any_cast". The
"argument type T in the function call" (as the standard puts it), is 'class
any'. The second bullet says "If T is a class type, its ... associated
namespaces are the namespaces in which its associated classes are defined"
which, in this case, is boost. Therefore namespace boost should be searched
for a template named "any_cast".


Boost list run by bdawes at, gregod at, cpdaniel at, john at