Re: [boost] Possible class submission: Sparse Array

I had figured this was the case, just wasn't sure :)
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

Sohail, After our discussion I'm going to be adding runtime versions of my existing compile-time bounds policies. I'll probably go with the design I suggested, i.e. a public set_limits() that has to be called before any element accesses, and that can only be called once. On Thu, 27 Apr 2006 08:41:58 -0700, Sohail Somani wrote:
I think I see what you're getting at here, but given that the policies are used through inheritance I'm not sure it is feasible in my class. I imagine that the programmer will call the set_limits() function soon after creating the sparse_array (indeed, probably the very next line), but as long as it is before the first element access it should not be a problem - there would, for instance, be nothing to stop you creating a sparse_array and then passing it by reference to a function that dynamically sets the size and then fills it.
For the reasons given in my original response to you I'm not keen to have resizeable bounds. However, again, there is nothing to stop the programmer writing their own bounds policy that allows this through a public function, as long as they recognise any problems that may arise with existing elements that have subscripts violating the policy. I'm working to put together some pages on a web-site with documentation and the current code for this class, so hopefully I'll have something to show people soon. Unfortunately I have to go to a funeral today, so there will be little done before tomorrow. Spencer -- <<< Eagles may soar, but weasels don't get sucked into jet engines >>> 8:11am up 40 days 19:44, 23 users, load average: 0.16, 0.08, 0.06 Registered Linux User #232457 | LFS ID 11703

Sohail, On Fri, 28 Apr 2006 08:25:57 +0100, Spencer Collyer wrote:
Scratch that last comment. Thinking about it some more this morning I think I now see what you are getting at. We could have a constructor taking (a reference to) an object of the bounds policy class, which simply passes that object to the class's constructor in the initializer list. It's so simple, I don't know why I didn't think of it before. I'll add it to the class interface. Spencer -- <<< Eagles may soar, but weasels don't get sucked into jet engines >>> 8:08am up 41 days 19:41, 23 users, load average: 0.04, 0.59, 0.88 Registered Linux User #232457 | LFS ID 11703
participants (2)
-
Sohail Somani
-
Spencer Collyer