Boost logo

Boost Users :

From: Jochen Hammann (jochen.hammann_at_[hidden])
Date: 2004-12-09 03:43:22


Hello JoaquĆ­n, Hello Pavel,

thank you for your responses.

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

The typedef SBothKeyExtractor_t causes an internal compiler error of the Visual C++ 7.1 Compiler, too.

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 this still doesn't work, try then
>
> struct SBothKeyExtractor_t: public composite_key<Element_t,...>
> {
> };
>
> // as before

The declaration of the struct fixes the problem. Now, I'm able to build
the example without an error. Thanks a lot.

For completeness. Below is the whole source code of my initial example, which
causes the internal compiler error:

#include <string>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/key_extractors.hpp>

using boost::multi_index_container;
using namespace boost::multi_index;

struct SSequence { };
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)
{
    using namespace std;
    using namespace boost;

    MultiIndex_t test;

    MultiIndex_t::index<SBoth>::type& both = test.get<SBoth>();

    return 0;
}

Regards,

    Jochen.


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