Creating template libraries from C++/Boost template libraries
Lyle Moffitt via Digitalmars-d
digitalmars-d at puremagic.com
Sun Mar 13 05:11:12 PDT 2016
I recently discovered D and absolutely love it. However, I feel
like I can't really be productive with it yet because of the
profound lack of libraries. I understand that linking to C
libraries is trivial and linking to C++ libraries is possible
(eventually easy with tools like LDC'c Calypso), but I can't help
but feel that doing these things beally hampers the power of the
original library. This is primarily for C++, which loses all its
generic programming capabilities.
To wit, if I want to use a class `foo<T>`, I have to specialize
it for every type I plan to use it for in D. This means having
either a huge library or having super-human precognition. What
I'm wondering is, is it possible to specialize this template for
a C++API version of D's Object and then re-use it as a template
on the D-side whilst preserving its generic programming
properties. I'd imagine this would have the same limitations as
using `void*` for generic programming in C, but it would at least
allow the retention of class information thought Object's
inheritance tree.
More information about the Digitalmars-d
mailing list