|
Boost : |
From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-04-27 11:41:58
> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Spencer Collyer
> Sent: Thursday, April 27, 2006 12:11 AM
> To: boost_at_[hidden]
> Subject: Re: [boost] Possible class submission: Sparse Array
>
> On Wed, 26 Apr 2006 12:33:06 -0700, Sohail Somani wrote:
>
> > Would there be a bounds type for specifying runtime bounds?
> It seems the
> > upper bound if specified, can only be specified at compile
> time and this
> > would limit the size of your arrays... Or is this by design?
>
> Because the bounds checking is specified using an inherited
> policy class,
> there is in principle no reason why run-time bounds cannot be
> used, and I
> did indeed look at doing this.
I had figured this was the case, just wasn't sure :)
> The option I came up with was to have a set_limit function on
> the bounds
> policy which you would call to define the limits at run time. The only
> reason I haven't gone ahead and done the work to implement run-time
> limits as yet is because I'm still not sure about the answers to a few
> questions:
I think you can have the sparse array implementation have an overloaded
constructor that takes an instance of the policy. With a set_limit you
may end up having invalid arrays for some length of time.
Then, I don't think there is anything stopping you from having a
reset_bounds/resize type function, but I'd rather only have them be set
once as you suggested.
To be honest, I'm quite used to having runtime dimensions specified and
ublas's sparse arrays interface is pretty good this way.
Thanks for your email!
Sohail
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk