cpp_binder, a not-yet-useful tool for generating C++ bindings
Marc Schütz via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Tue Sep 22 04:04:15 PDT 2015
On Tuesday, 22 September 2015 at 04:07:54 UTC, Ola Fosheim
Grostad wrote:
> On Tuesday, 22 September 2015 at 00:31:45 UTC, Paul O'Neil
> wrote:
>> While D and C++ const don't quite share semantics, they're
>> petty close and they mangle the same way. I do what ZombieDev
>> has in the table.
>
> Going from const to mutable like that breaks the type system...
Can pragma(mangle, ...) be used on types? Then we can define a
C/C++ compatible `HeadConst` template that simulates C/C++ const
semantics, while still being mangled correctly:
template HeadConst(T) {
pragma(mangle, const(T).mangleof)
struct HeadConst {
// @disable opAssign();
// and whatever else is necessary for head-const
}
}
The constructor would of course need to make sure that it accepts
only types with non-const indirection.
More information about the Digitalmars-d-announce
mailing list