Is it possible to restrict the element type of a custom vector to some concrete type from a union by type constraint in the definition, rather thandoing runtime check in the constructor?
No, but the check doesn't have to happen at runtime. It should be able to be checked at compile time
Not always, the element type may depend on data
Last updated: Nov 22 2024 at 04:41 UTC