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:00:39


Thanks very much to Steven Watanabe for getting back to me regarding my lower_bound/upper_bound question - I will take a look at equal_range() as suggested.   I have been reading around and found the random_access index.  This is useful to me to find any random item in my multi_index container.    I am having a problem compiling though, I get error c2247 when I try to use the square bracket operator [] to access a randomly indexed item.  The error message says that this is an inheritance issue with the protected status of the operator...   c:\program files\microsoft visual studio\myprojects\xmltest\xmltest\xmltestapp.cpp(899) : error C2247: 'boost::multi_index::detail::random_access_index<SuperMeta,TagList>::operator []' not accessible because 'boost::multi_index::detail::ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>' uses 'protected' to inherit from 'boost::multi_index::detail::random_access_index<SuperMeta,TagList>' I have based my code on example 10 in the Multi Index Documentation source examples. I can see that Daniel Bradburn had the same problem, detailed in a post dated April 6th 2010.  Joaquin M Lopez Munoz responded, asking for a little test project to demonstrate, but there I can find no resolution to his (and, thus, my) question.  I have also tried using the "#define BOOST_NO_MEMBER_TEMPLATE_FRIENDS" line, but no joy.  For now, I can work around by either hacking the protected state to public or iterating the container to a random point.   I have updated Boost to 1_50 and created an isolated test case in a small project to replicate the issue.  I am using Visual Studio 9 on Windows Vista.   Thanks in advance for any help with this.   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