std::count leaked outside namespace std?
Paolo Carlini
paolo.carlini@oracle.com
Tue Apr 23 22:43:00 GMT 2013
On 04/23/2013 11:26 PM, bd satish wrote:
> Hi,
>
> Here's a simple program:
>
> #include <algorithm>
> #include <vector>
>
> int main()
> {
> std::vector<int> vec;
> count(vec.begin(), vec.end(), 0); // shouldn't this be std::count ?
> }
>
> The above compiles successfully, but I think it shouldn't. I expect a
> message like "error: `count` not declared in scope" because I meant to
> say std::count. Isn't this a bug, or am I missing something?
You are: https://en.wikipedia.org/wiki/Argument-dependent_name_lookup
Paolo.
More information about the Gcc
mailing list