Re:Concepts: The Future of Generic Programming [pdf]
by pjmlp on Wednesday December 21, 2016 @04:15AM
(#13227805)
Besides what everyone else is replying about dependent typing, you can get that in C++ by a mix of concepts, classes and operator overloading.
It isn't as clean, but it does the job.
For example you could have a PositiveNumber class, with the mathematical operators overloaded that always validated the invariant of the number being positive.
It isn't as clean, but it does the job.
For example you could have a PositiveNumber class, with the mathematical operators overloaded that always validated the invariant of the number being positive.