Admin Tensor ڧѧ 17.12.2011 03:12:
> Peter Zotov wrote in post #1037076:
>> I wonder if we can make a more efficient Array by making it a 
>> circular
>> buffer,
>> so that #shift and #pop would always be O(1), and #unshift and #push 
>> be
>> O(n) only if the array grows bigger. Are there any implications I 
>> don't
>> see?
>
> Hi,
>
> Is there some C++ STL-like data structure in Ruby?  Or is it a good 
> idea
> if I (or some other people) try to make one?  With STL-like data
> structure you can have the best structure for the problem at hand, 
> and
> we don't have to use Array and Hash all the time.
>
> Regards,
>
> Bill

Array _is_ std::vector, and Hash, again, is exactly std::map, if you 
leave out
the strong typing part. This whole discussion is about implementing a 
construct
like std::queue (or deque).

-- 
   WBR, Peter Zotov.