Boost logo

Boost Users :

Subject: [Boost-users] [Multi Index] Random Access Index C2247 Compile Error
From: Steve Hibbert (hiblet_at_[hidden])
Date: 2012-07-09 07:30:26


Igor, thanks for getting back to me.  Very good suggestion.   I was trying to gain 'direct random access' to the items in the container by using the bracket operator on the MIC object, as you would do on a vector... "m_micOrders[index]".    This is how example 10 in the Boost documentation shows the usage, using a text block stored in a MIC called tc, and using tc[pos] to access the pos'th element.   After a review of the MIC source code and a bit of thinking, I have tried first getting a reference to the random access index, and then using the bracket operator on the reference to the index like this (where the random index is the seventh defined index in my case)...   OrderMIC::nth_index<6>::type& index6 = m_micOrders.get<6>(); spOrder = index6[ index ];   It seems a general rule with MIC's is that you should never call any member functions on anything other than a reference to one of the indices.  So, thanks very much for your help, and I am off and running again, much obliged.   Steve


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net