Multi Index with BOOST_AUTO question.

Hello all,I'm a newbie to multi-index. I ran into a strange problem with
VS2008. When using BOOST_AUTO with multi-index I'm getting compilation
errors (C2248) . Please see the following code.
*<snip>*
*
*
#include <iostream>
#include <string>
using namespace std ;
#include
Container ;
typedef Container::index<byNumber>::type TestByNumber ; typedef Container::index<byString>::type TestByString ; Container c ; c.insert (Test(5, "Surya")) ; c.insert (Test(15, "Kiran")) ; //TestByNumber& tests = c.get<byNumber>() ; BOOST_AUTO(tests, c.get<byNumber>()) ; BOOST_FOREACH (Test t, tests) cout << t << endl ; return 0 ; } *</snip>* * * Compilation for this case fails with C2248. If I replace the BOOST_AUTO with the previous line's statement, compilation goes well. This happens with VS2008 only. with VS2005, there's no issue with BOOST_AUTO. Am I missing something here? Thanks, Surya

On Tue, Oct 13, 2009 at 10:59 PM, Igor R
It worked. What is the difference ?. Which is correct ?
BOOST_AUTO(a, A) ; // is A a; BOOST_AUTO(&a, A) ; // is A &a;
Since you can't copy the index, you should define a reference.
I got that. I've looked at Boost.Typeof documentation. But why was it working with VS2005 ? Thanks, Surya
participants (2)
-
Igor R
-
Surya Kiran Gullapalli