
about policies on 18.08.2009 at 0:07 joel wrote :
and could you please write an example of policy implementation of yours?
Rutger wrote:
Yes, or provide access to the library already ... I don't like showing incomplete code. I'll build up a small toy example for policies soon.
since i don't know what a policy concept actualy is i'm going to bla bla a little it'll be convenient i suppose to write matrix<double> m; matrix<double, symmetric> symm; matrix<double, upper_triang> upper_tr; //etc. matrix<double, band|symmetric> band_symm; //etc. implementation: enum mode { general = 0, symmetric = 1<<0, upper_triang = 1<<1, lower_triang = 1<<2, band = 1<<3 //etc. }; template<typename type, mode m = general> class matrix; tempplate<typename type> //explicitly specializing class matrix<type, general> //... //legal combinations of modes {/*...*/}; //providing unique interfaces //to unique entities template<typename type> class matrix<type, symmetric> //... {/*...*/}; template<typename type> class matrix<type, band|symmetric> //... {/*...*/}; //etc. since illegal combinations are not specializaed it will be impossible to instantiate them maybe it's a piece of crap but i can't invent a better one yet -- Pavel