2 ms·
This seems like a nice article series on the subject http://akrzemi1.wordpress.com/2013/11/18/type-erasure-part-i/ http://akrzemi1.wordpress.com/2013/11/18/type
by corysama 12y ago
This seems like a nice article series on the subject http://akrzemi1.wordpress.com/2013/11/18/type-erasure-part-i/ http://akrzemi1.wordpress.com/2013/11/18/type-erasure-part-i...
Just getting started on it, it seems that the theme is that you can't have the same binary code work on different types without having a run-time indirection in there somewhere. But, you can use templates to keep that indirection convenient and type safe. And, you can structure your templates to only specialize a minimal amount of code necessary to interface your type into a non-specialized algorithm.
- dllthomas 12y agoRight, that looks like an exploration of what I was talking about (and at a skim, looks solid). "you can't have the same binary code work on different types without having a run-time indirection in there somewhere" That's certainly the case, but if you're passing by reference you already have an indirection, so that may or may not mean additional run-time overhead.