----- Mensaje original -----
De: Hugh Hoover
On Oct 30, 2007, at 10:31 AM, Ovanes Markarian wrote:
Hello!
[...]
I have on Visual C++ 2005 an access violation, since I am trying to retrieve a view by it's hashed keys into the const container.
Are you doing what I did yesterday, which is to keep the view as an object rather than as a reference?
Like:
typedef multi_index_container< ... > multi_index_collection; typedef multi_index_collection::nth_index<1> my_index; multi_index_collection collection;
my_index mi = collection.get<1>();
rather than
my_index& mi = collection.get<1>();
???
I place my bet on this too. This misuse of B.MI interface is prevented against at the end of the section at http://tinyurl.com/2vlq2n , although I'm afraid many readers will overlook the warning. In my discharge I must say that in other compilers the &-less code actually does not compile, for instance GCC 3.4 says: .../boost/multi_index/ordered_index.hpp:540: error: `boost::multi_index:: detail::ordered_index<...>::ordered_index( const boost::multi_index::detail::ordered_index<...>&) [with KeyFromValue = ...]' is protected Alas the code compiles in VC 8.0 because I was forced to make indices' copy ctors public due to a compiler bug with in-class using declarations for template functions (more details at http://tinyurl.com/354k63 ). Hope the rest of your experience with the lib has been more pleasant. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo