Boost logo

Boost :

Subject: Re: [boost] Proposal: Linear map
From: Amir Ansari (amir.ansari80_at_[hidden])
Date: 2012-07-18 09:53:45


boost::flat_map seems to provide exactly what I am looking for but there is one deal breaking caveat - it stores the key separately from the data. I don't know if this problem is already solved, but the way I see it, if the data needs the key for some other computation, we either need to replicate the key (memory usage) or take the computation out of the data class, which breaks encapsulation.   Do you think it would make sense to have another container which simply uses the comparator to directly compare the objects being stored? ________________________________ From: Ben Pope <benpope81_at_[hidden]> To: boost_at_[hidden] Sent: Tuesday, July 17, 2012 1:15 PM Subject: Re: [boost] Proposal: Linear map On Tuesday, July 17, 2012 03:13 PM, Amir Ansari wrote: > Hi, > > In my work I have repeatedly had the need to create a sorted array in which I can insert/lookup from using a key. This is like a map except that it uses an array. The contention is that in some cases, it is faster to insert/remove from a sorted array rather than traversing a tree (the underlying data structure for a map) which involves pointer de-referencing. I would like to call the class linear_map. Looking forward to feedback from everyone. Does it differ from boost::flat_map: http://www.boost.org/doc/libs/1_50_0/doc/html/boost/container/flat_map.html Ben _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk