March 31, 2012 Transfering CTFE classes to runtime | ||||
|---|---|---|---|---|
| ||||
Hi all, I recently had a need to use some classes from CTFE so I made a couple of helper methods to do just that: https://github.com/mrmonday/misc/blob/master/transfer.d Basic usage: ---- enum prepared = prepare(new MyClass); auto transferred = transfer!MyClass(prepared); ---- It's rather rough and under-documented, could be of use though. Known issues: * Classes which have member variables of class types don't work * Classes must have a default constructor * transfer() requires the type parameter to be of the same class as used at compile time - super classes won't work. They shouldn't be too hard to resolve for the most part though. -- Robert http://octarineparrot.com/ | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply