
Hi Joaquín, Éric I appreciate your response, Before that I got some workaround from the web and the snippet I have written to port it to my existing project worked until I face real problem. My observation is like when I have Ordered_index with std::string, the code I have written compiles really well and works also. But when I remove this ordered_index, the code does not compile. Here is the code that compiles: <<Multi_index_container_working.txt>> Here is the code that does not compile: <<Multi_index_container_not_working.txt>> If you see the difference I have only two lines commented. ... //ordered_non_unique<tag<name>,BOOST_MULTI_INDEX_MEMBER(employee,std::string,name) >, .... .... //typedef boost::multi_index::index<employee_set,name>::type employee_set_by_name;... Same boost::multi_index::index<employee_set,ssnumber>::type is not working if the std::string is not indexed. right now I am working with dummy string. But I need to scrap the string and have some real code in place that should go into my project. If I am not able to solve this. I can not use multi_index_container and it is real loss for me. Help always appreciated. Thanks in advance. aashit ps: please consider these txt files are cpp files. ________________________________ From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Joaquín Mª López Muñoz Sent: Tuesday, February 07, 2006 9:39 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] Multi_index Container Hello Aashit, "Soni, Aashit" ha escrito: Hi all, I am newbie to Boost library. I am trying to use multi_index_container library in my project. The problem I have at my hands needs One Hash index and one ordered indexed. I refer the Boost tutorial and Advance topic and tried to write the following snippet. But when I compiled it gives compilation error. I searched lot of different options and tried to fix it but I could not able to do it so. If you can guide me how to shut the compilation errors it will be great. If anyone of you is having any decent example tried out for Hash having ordered indexes please send it to me so I can go through and build my logic on top of that.... Code Follows. I am using MSVC SP6 on Win XP . This is primarily the problem: To make MSVC 6.0 compile a program using Boost.MultiIndex you've got to observe some stricter rules than in the normal case. Please read the section on MSVC 6.0 at http://boost.org/libs/multi_index/doc/compiler_specifics.html#msvc_60 typedef employee_set::index<employee_set,ssnumber>::type employee_set_by_ssn; Problem #1: MSVC 6.0 does not support the "index" nested typedef. Instead, write typedef index<employee_set,ssnumber>::type employee_set_by_ssn; employee_set_by_ssn& ssn_index=es.get<2>(); Problem #2: MSVC 6.0 does not support the get member function, use the global version instead: employee_set_by_ssn& ssn_index=get<2>(es); With these changes, and also tweaking /Zm and /ZI (as explained in the aforementioned section), your program compiles. Bare in mind that your compiler is very old and broken and making Boost.MultiIndex work for it can be quite a challenge, although it is doable. Good luck with your project, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

"Soni, Aashit" ha escrito:
Hi Joaquín, Éric I appreciate your response, Before that I got some workaround from the web and the snippet I have written to port it to my existing project worked until I face real problem. My observation is like when I have Ordered_index with std::string, the code I have written compiles really well and works also. But when I remove this ordered_index, the code does not compile.Here is the code that compiles: <<Multi_index_container_working.txt>>Here is the code that does not compile: <<Multi_index_container_not_working.txt>>If you see the difference I have only two lines commented.
Yes, I'm able to reproduce the problem you report under MSVC 6.0. Two remarks: * The problem does not show with the CVS version of Boost.MultiIndex (to be shipped in Boost 1.34), as it includes a number of optimizations alleviating the choking of MSVC 6.0 with very long symbol names, which is the core reason for this weird behavior. * Until you switch to Boost 1.34 (and even when you do), you can try avoiding the use of tags and using numeric identifiers instead. Tags add some stress to such a weak compiler as MSVC 6.0. The attached file is a variation of your Multi_index_container_not_working.txt file where tags have been suppressed and numerical identifiers used instead. I have checked it out to compile and work OK under MSVC 6.0. I hope this helps, please keep me informed otherwise, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
participants (2)
-
Joaquín Mª López Muñoz
-
Soni, Aashit