RE: [chuck-users] Problem with chuck language specification
You can call size() on a map. Works fine. I can't speak for all implementations, but Microft STL has a in internal _size member, so this is a low-cost operation. - Robin
-----Original Message----- From: chuck-users-bounces@lists.cs.princeton.edu [mailto:chuck-users- bounces@lists.cs.princeton.edu] On Behalf Of Ge Wang Sent: Friday, September 16, 2005 1:25 AM To: ChucK Users Mailing List Subject: Re: [chuck-users] Problem with chuck language specification
Hi Robin and all,
Problem: Chuck language definition uses cap(), when it should use size().
This is a good point to bring up. For now, we use cap() instead of size(), because cap() means capacity whereas size() may have more than one interpretation. However, size() is on the way. We plan to support push_back() and pop_back() operations on arrays (as you saw in the source), which would increment/decrement 'size' and manage the capacity automatically. For this case, size() would make sense (and would be more consistent with STL).
If this naming turns out to be undesirable, we may modify it for a future version.
Another problem: we are trying find a good solution for to get the size of the associative array, and maybe a way to iterate through the map. Ideally, this would be concise, clear, and does not conflict with operations dealing with the vector portion of the array. Thoughts anyone?
Best Ge!
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (1)
-
Robin Davies