object.factory with template classes for serializing subclasses automatically
timotheecour
thelastmammoth at gmail.com
Sun Sep 9 16:27:15 PDT 2012
Is there a way to use Object.factory with template classes?
eg:
----
class A(T){
T x;
}
auto a=Object.factory("A!int");
----
Right now this fails (returns null).
Use case:
If we had this, it would GREATLY simplify serialization (eg as in
the orange library) by not having to manually register subclasses
of a given class, eg:
class B{}
class C:B{int x;}
B c=new C;
right now with orange, we need to register class C before calling
serialization. If something like Object.factory("A!int") worked,
this step could be made automatic.
More information about the Digitalmars-d-learn
mailing list