
Le 04/05/2010 16:39, Chad Nelson a écrit :
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 05/04/2010 06:07 AM, Mathias Gaunard wrote:
It might be interesting to make all your types convertible to views (same as your integers, but only behaving as references to them), and have your algorithms take views. That way you wouldn't necessarily need the dynamic allocation.
I'm not sure I understand what you're suggesting. If views are the same as my integers, then they're essentially the same as base_integer as well, so that's what I'm already doing. Or am I missing something?
They do not own anything, they're simply thin wrappers on top of the pointer, and you can construct them from the pointer and whatever information you need as well. That way the user does not need to allocate his memory with dynamic memory allocation -- or even with your type -- to run your arbitrary precision algorithms.