extern(C++, ns)
tsbockman via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jan 20 15:53:38 PST 2016
On Wednesday, 20 January 2016 at 22:13:09 UTC, Walter Bright
wrote:
> You can always write a module that all it does is import a
> bunch of other modules, with a bunch of aliases which can be
> used to make those imports appear in another namespace:
>
> ----module core.stdcpp.vector----
> extern (C++, std) { struct vector { } }
>
> ----module core.stdcpp.string----
> extern (C++, std) { struct string { } }
>
> ----module stl------
> private import core.stdcpp.vector;
> private import core.stdcpp.string;
> ...
> extern (C++, std)
> {
> alias core.stdcpp.vector.std.vector vector;
> alias core.stdcpp.string.std.string string;
> ...
> }
>
> ---module user-----
> import stl;
>
> std.vector v;
> std.string s;
The thought of needing to do that for (potentially) every single
symbol being imported is depressing. What happened to DRY?
More information about the Digitalmars-d
mailing list