|
Boost Users : |
From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2007-10-30 15:10:12
----- Mensaje original -----
De: Hugh Hoover <hugh_at_[hidden]>
Fecha: Martes, Octubre 30, 2007 7:02 pm
Asunto: Re: [Boost-users] [multi-index] bug or not?
Para: boost-users_at_[hidden]
>
> 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
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