4 ms·
You could do this with the factory pattern, applied to a template type. Though, if you would do this for the whole range of say, an int, you would probably blow
by stkdump 5y ago
You could do this with the factory pattern, applied to a template type. Though, if you would do this for the whole range of say, an int, you would probably blow up the compiler. How is that done in languages that do support this? Or does it require shipping the compiler, so that you can run the compiler at runtime?
- steveklabnik 5y ago> You could do this with the factory pattern, applied to a template type. I don't know enough about C++ templates here, but you cannot in Rust. > How is that done in languages that do support this? I don't know enough about the implementations to actually say, to be honest. Most of them aren't systems languages, and so have significantly less constraints on implementations, and less monomorphization. I imagine that helps.