
In large-scale computation code, fine control of allocation is a must. The ability to have the major data structures with their hand-tuned allocation strategies freely intermix with "casual" variables and constants in expressions, as parameters, etc is pretty important. Bleeding-edge factorization algorithms for instance allocate large numbers of, uhm, numbers all of which have roughly the same number of bits. Cache-and-paging efficient allocation for these numbers can make the difference between success and failure. But you'd like to be able to call functions that were written without awareness of your custom allocation strategy. The concerns for both interoperability and efficiency are inescapable. I believe the interface should allow for runtime polymorphism but be constructed so that a decent optimizing compiler can "almost always" infer the correct static call in code that is not intentionally using runtime polymorphism. That may take some template specializations but it would be worth it. Finally, how does this relate to gmp? Are we trying to work around licensing issues or is it an interface definition issue? Where the user has a tested and tuned gmp implementation, can the new library be configured as a wrapper for it?