Multi-index collection

113 views
Skip to first unread message

Eric Springer

unread,
Jun 18, 2012, 2:07:05 AM6/18/12
to scala...@googlegroups.com
So I've come to Scala from C++, and while in general Scala's almost as good -- there's one gaping hole I have not been able to fill:

http://www.boost.org/doc/libs/1_49_0/libs/multi_index/doc/index.html

Which, I daresay is better than even sliced bread. [Disclaimer: if you're a scala programmer, I'd urge strong caution before using it -- as when you go back to scala you'll forever code with eyes turned skyward]. That said, do read the summary to get an idea of what it does. But in a nutshell it allows to to easily create collections, where you describe your use case (e.g. my situation right now: A collection of accounts, with efficient look via via two different criteria (id and username) while being able to traverse based on a date].  With multi_index, this simply comes together beautifully  -- but in Scala, AFAICT my options are to either go through the huge hassle of creating/using an (in-memory) database and/or create my own specialized collection for this exact purpose (and spend the next day coding and testing it to make sure I main all the indexes properly etc.)

Actually, a better question: Is creating a generic solution like boost::multi_index even possible?  (And if so, would anyone be willing to accept my genuine and undying gratitude for either taking a stab at it, or explaining how it could be done?)


Thanks a lot!
Eric

Ramon Buckland

unread,
Sep 11, 2012, 4:00:37 AM9/11/12
to scala...@googlegroups.com
Hi Eric, 

I was wondering if you had any luck on either finding or implementing  a Scala Multi Indexed Map or an approach to how you could do it ? 

Many regards
Ramon
Reply all
Reply to author
Forward
0 new messages