From: int19h on
On Nov 23, 11:36 am, Mathias Gaunard <loufo...(a)gmail.com> wrote:
> On 22 nov, 13:27, ap...(a)student.open.ac.uk wrote:
>
> > I have recently started using java and have come across the
> > LinkedHashMap. For those not in the know this is like a hash table (ie
> > fast indexing via hash function) but also has the neat feature where
> > iterating through the table the entries are retrieved in the order
> > they were inserted. This is really useful when implementing caches. I
> > wonder what plans there are (if any) for a similar class in the std
> > library?
>
> std::list<T> (or std::vector<T> or whatever) + std::unordered_map<T*>

Better yet, std::unordered_map<T> +
std::list<std::unordered_map<T>::iterator>

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Roman.Perepelitsa on
On 22 Nov, 15:27, ap...(a)student.open.ac.uk wrote:
> I have recently started using java and have come across the
> LinkedHashMap. For those not in the know this is like a hash table (ie
> fast indexing via hash function) but also has the neat feature where
> iterating through the table the entries are retrieved in the order
> they were inserted. This is really useful when implementing caches. I
> wonder what plans there are (if any) for a similar class in the std
> library?

Use boost::multi_index library.

typedef multi_index_container<
T,
indexed_by<
sequenced<>, // list-like index
hashed_unique<> // hashed index
>
> hash_list;

Regards,
Roman Perepelitsa.

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]