[Multi Index] Random Access Index C2247 Compile Error
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
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.
Applying an accessor on the MIC itself means applying it on its 1st index (its kindof "default" index).
participants (2)
-
Igor R
-
Steve Hibbert