extern(C++, ns)

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 11 09:40:21 PST 2016


On 1/11/2016 12:45 AM, Rainer Schuetze wrote:
> This yields:
>
> test.d(11): Error: stl.vector.std at stl\vector.d(3) conflicts with stl.map.std
> at stl\map.d(3)
> test.d(12): Error: stl.vector.std at stl\vector.d(3) conflicts with stl.map.std
> at stl\map.d(3)
> test.d(12): Error: template identifier 'map' is not a member of namespace
> 'stl.vector.std'

Of course it does, because you're looking up "std" and "std" is in both vector 
and map. Again, I am hornswoggled by my inability to explain how name lookup works.


> This works to disambiguate, but it is not nice (but maybe inevitable):
>
> void main()
> {
>      stl.vector.vector!int v;
>      stl.map.map!(int,int) m;
>
>      writeln(v);
> }

Following the rules I listed:

import stl.vector;
import stl.map;

void main()
{
     vector!int v;
     map!(int,int) m;
}

compiles without error.


More information about the Digitalmars-d mailing list