boost/pending/mutable_queue missing clear() function
 
            I notice that mutable_queue is missing a clear() function, i.e. a low overhead way of emptying the entire queue (without resorting to repeated pops). However, I think clear() can be implemented as follows: void clear() { clear(); } Which is efficient and (often) fast. I don't think there is any need to "clear" the index_array (since the constructor for mutable_queue doesn't initialize its contents) Lloyd J. Lewins Fellow, Raytheon Co., llewins@raytheon.com +1 (310) 647-8832
 
            On Feb 11, 2005, at 5:39 PM, Lloyd J Lewins wrote:
I notice that mutable_queue is missing a clear() function, i.e. a low overhead way of emptying the entire queue (without resorting to repeated pops). However, I think clear() can be implemented as follows:
void clear() { clear(); }
Which is efficient and (often) fast. I don't think there is any need to "clear" the index_array (since the constructor for mutable_queue doesn't initialize its contents)
Added. Doug
 
            Douglas Gregor <doug.gregor@gmail.com> writes:
On Feb 11, 2005, at 5:39 PM, Lloyd J Lewins wrote:
I notice that mutable_queue is missing a clear() function, i.e. a low overhead way of emptying the entire queue (without resorting to repeated pops). However, I think clear() can be implemented as follows:
void clear() { clear(); }
Which is efficient and (often) fast.
Surely that one only runs until you blow the stack. Am I missing something? -- Dave Abrahams Boost Consulting www.boost-consulting.com
 
            On Mar 14, 2005, at 12:55 PM, David Abrahams wrote:
Douglas Gregor <doug.gregor@gmail.com> writes:
On Feb 11, 2005, at 5:39 PM, Lloyd J Lewins wrote:
I notice that mutable_queue is missing a clear() function, i.e. a low overhead way of emptying the entire queue (without resorting to repeated pops). However, I think clear() can be implemented as follows:
void clear() { clear(); }
Which is efficient and (often) fast.
Surely that one only runs until you blow the stack. Am I missing something?
No, but neither did I :) The correct code (in CVS of course) is: void clear() { c.clear(); } Doug
participants (3)
- 
                 David Abrahams David Abrahams
- 
                 Douglas Gregor Douglas Gregor
- 
                 Lloyd J Lewins Lloyd J Lewins