User Tools

Site Tools


Inheritance, Covariance & More (Template Metaprogramming)

  • Problem. I can't implement a covariant “pointer” type to which I can add my own features (notably automatic nulling) but also access a ref counting etc.
  • My solution to this is more about demonstrating the walking and iteration of data structures than any practical use
  • Several C++ features are missing from this, notably multiple inheritance. Some curse at multiple inheritance but as C++ has only the single feature for object model programming (unlike other languages with built in “category”, “interface”, “extends” features I use multiple inheritance a lot, especially for interfaces.
#include <ptr.h>
int main(int argc, char * argv[])
    ptr<void> _p_void;
    return -1;
managing_simple_inheritance_with_c_templates.txt · Last modified: 2017/09/05 08:33 by xylene