Boost logo

Boost Users :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2007-06-28 02:56:34


hongleij_at_[hidden] ha escrito:

> //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.;-)

You're welcome :) As for your current problem, please try the following
compiler
tweaks (they're proposed for VC++ 6.0 in
http://boost.org/libs/multi_index/doc/compiler_specifics.htm , but
seemingly they
are also aplicable to VC++ 7.1):

* Try disabling the option /Gm (Enable Minimal Rebuild.)
* If in debug mode, try switching from /ZI (Program Database for Edit
and Continue)
to a less demanding type of debugging information (/Zi, /Z7 or /Zd.)
* Set the compiler option /Zm (Specify Memory Allocation Limit) to
increase the
amount of memory available for compilation. Usual values for this option
range
from 300 to 800.
* Play with the precompiled headers options. Usually, turning this
feature off yields
the best results.

Good luck, please report back your results,

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