
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/03/2010 03:40 PM, vicente.botet wrote:
You need to mut the minimal part on the derived part, but don't add to much on the base class.
The usual way to do that is via virtual functions. I've been trying to avoid virtual functions in the base_integer class, for efficiency's sake; the intermediary class mentioned below is intended to solve the problem without need of them.
Chad I need to ask you if you knwo the tecnique we are suggesting you, i.e. CRTP Curious Recurring Template Pattern. If this is not the case we could explain you in more detaill how it wan be used to your case.
I've looked into it at least twice in the past, but that's one of those things that I can never seem to remember. Looking it up again... ah, now I remember why I can never seem to remember it: I've never understood the purpose of it in the first place, and never seen it used. Hm... I *think* I see it now. At least, some of the time I think I do. :-) Please check my understanding: you're suggesting that I use functions in base_integer to do the allocation, and have them call other functions in base_integer to do the things that are different between fixed_integer and the variable-length integers. But then override those functions in the fixed_integer classes, not as virtual functions, but using CRTP to call the overridden functions. Am I right? - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvfTBEACgkQp9x9jeZ9/wQgHwCfQFPPYz3+/74hILL7KTGLpwFx InsAoIxIWXbRtQJ2hZ785KFzEN9k9EEN =0UZg -----END PGP SIGNATURE-----