
On 05/04/2010 05:21 PM, Chad Nelson wrote:
On 05/04/2010 02:28 PM, Jeffrey Lee Hellrung, Jr. wrote:
[...]
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.
+1, and going the natural step further, build these algorithms off a view *concept*, rather then hard-coding a specific view class, for maximum flexibility. The requirements you need *might* be as simple as existing range requirements in many cases (see Boost.Range).
I'm afraid they'll be slightly more complex, as the view will need to know the sign of the integer as well (and be able to alter it, for mutable arguments). So I'll probably need to hard-code at least one view class anyway. We'll see when I get to it, which I hope will be tonight.
Yes, you're right, start with a concrete view class, just with the additional abstraction to a view concept in the back of your mind. Later you can add support for a more concept-based implementation it if it's deemed useful. - Jeff