Is it possible to implement Haskell typeclasses in C++? If yes, then how?
There's a few papers on this, which might be useful as background reading:
The similar mechanism in C++ is called "concepts". The idea is to define a typeclass by defining the requirements of any type belonging to that class. C++ iterators make extensive use of concepts, and C++0x had intended to support direct syntax for them (rather than the indirect template tricks to perform concept checks C++ currently employs), but it appears this support has been dropped from the standard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With