Boost logo

Boost Users :

From: hongleij_at_[hidden]
Date: 2007-06-27 23:20:04


 //boost
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp>
#include "boost/multi_index/key_extractors.hpp"
using namespace ::boost;
using namespace ::boost::multi_index;

#include <string>

struct Peer
{
    std::string userid;
    int age()const {return age_;}
private:
    int age_;
};
struct CPeer:public Peer
{
    int index;

};

struct Peer_age_extractor
{
   typedef int result_type;
   const int operator()(const CPeer& peer)const
   {
       return peer.age();
   }
};

struct userid{};
struct age{};
typedef multi_index_container<
   CPeer,
   indexed_by<
   hashed_unique<tag<userid>,member<Peer,std::string,&Peer::userid> >,
   hashed_non_unique<tag<age>,const_mem_fun<Peer,int,&Peer::age> >//
  // hashed_non_unique<const_mem_fun<Peer,int,&Peer::age> > //without a tag will be ok.
    //hashed_non_unique<tag<age>,Peer_age_extractor > //this line with cause the same question.
>
> CPeersType;

I get this in vs7.1 with sp1:

------ Build started: Project: multi_index1, Configuration: Debug Win32 ------

Compiling...
hash_test.cpp
f:\boost_1_34_0\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(48) : fatal error C1001: INTERNAL COMPILER ERROR
        (compiler file 'f:\vs70builds\6030\vc\Compiler\CxxFE\sl\P1\C\main.c', line 1164)
         Please choose the Technical Support command on the Visual C++
         Help menu, or open the Technical Support help file for more information

Build log was saved at "file://g:\cpp\boost\multi_index1\Debug\BuildLog.htm"
multi_index1 - 1 error(s), 0 warning(s)

 yet this can compile well in gcc 3.4.
i really don't know why.
many thanks for JOAQUIN LOPEZ MU?Z 's past help.;-)

°Ù Íò Íæ ¼Ò Í¬ Íæ µÄ ÀÖ Ô°£¬ÈË Æø ±¬ ·¢ µÄ ÃÎ »Ã Î÷ ÓÎ



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