[multi-index] bug or not?

Hello! I have a question regarding the multi-index behaviour, Let's say I have a multi-index container containing some hashed keys. What should happen with this container is empty and I retrieve an indexed by hash view into it? 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. Many thanks, Ovanes

On Oct 30, 2007, at 10:31 AM, Ovanes Markarian wrote:
Hello!
I have a question regarding the multi-index behaviour,
Let's say I have a multi-index container containing some hashed keys. What should happen with this container is empty and I retrieve an indexed by hash view into it?
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>(); ??? Hugh Hoover Enumclaw Software

----- 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

Yes, this is really pitty!
I really use copy ctor in the code to construct a view. And the most
interesting thing is that it sometimes crashes sometimes not! I don't know
why.
Best Regards,
Ovanes
On 10/30/07, "JOAQUIN LOPEZ MU?Z"
----- Mensaje original ----- De: Hugh Hoover
Fecha: Martes, Octubre 30, 2007 7:02 pm Asunto: Re: [Boost-users] [multi-index] bug or not? Para: boost-users@lists.boost.org 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 mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
"JOAQUIN LOPEZ MU?Z"
-
Hugh Hoover
-
Ovanes Markarian