|
Boost Users : |
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2004-12-08 17:46:42
Hammann, Jochen <Jochen.Hammann <at> realtech.com> writes:
>
> Hello,
>
> I'm new in using the MultiIndex container of Boost 1.32.0. To get familiar
> with this library I wrote a small example. During the compilation with
> the Microsoft Visual C++ 7.1 compiler I encounter an internal compiler error.
>
> The error occurs, if I use the MultiIndex container with the following
> configuration:
> - Specification of tagged indices.
> - Specification of one composite_key template parameter.
> - Specification of at least three indices.
>
> Example:
>
> struct SFirst { };
> struct SSecond { };
> struct SBoth { };
>
> typedef std::pair<std::wstring, std::wstring> Element_t;
>
> typedef multi_index_container<Element_t,
> indexed_by<ordered_non_unique<tag<SFirst>, member<Element_t, std::wstring,
&Element_t::first> >,
> ordered_non_unique<tag<SSecond>, member<Element_t, std::wstring,
&Element_t::second> >,
> ordered_unique<tag<SBoth>, composite_key<Element_t,
> member<Element_t,
std::wstring, &Element_t::first>,
> member<Element_t,
std::wstring, &Element_t::second> > > > > MultiIndex_t;
>
> //...
>
> int main(int argc, char** argv)
> {
> MultiIndex_t test;
>
> MultiIndex_t::index<SBoth>::type& both = test.get<SBoth>();
>
> return 0;
> }
>
> If I compile this code I get the following internal compiler error:
>
> d:\Libraries\DLLs\Boost\Boost_1_32_0\inc\boost\tuple\detail\tuple_basic.hpp
(612) : fatal
> error C1001: INTERNAL COMPILER ERROR
> (compiler file 'msc1.cpp', line 2701)
> Please choose the Technical Support command on the Visual C++
> Help menu, or open the Technical Support help file for more
information
>
> If I try to access the first (#0) and second (#1) index with their respective
tags,
> everything works fine. Also, I'm able to access all three indices by their
numerical
> value without an error.
>
> Is the declaration of the MultiIndex_t typedef wrong?
>
Hi, Jochen.
As Pavel says, it'd be great if you can post a complete
snippet showing the crash, so that we can try compiling
it in other platforms.
In the meantime, though, my hunch is that the compiler
is having a hard time with the length of the symbol names
generated by your definition (once expanded, it gets
pretty long.) This of course is not your fault. Please
try the following:
...
typedef composite_key<Element_t,...> SBothKeyExtractor_t;
typedef multi_index_container<Element_t,
indexed_by<
ordered_non_unique<tag<SFirst>,...>
ordered_non_unique<tag<SSecond>,...>
ordered_unique<tag<SBoth>, SBothKeyExtractor_t>
>
> MultiIndex_t;
if this still doesn't work, try then
struct SBothKeyExtractor_t: public composite_key<Element_t,...>
{
};
// as before
which definitely shortens the symbol names for the types
generated by your program. Oh, and please report
your results (thank you!)
Hope this helps,
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