Boost logo

Boost Users :

From: Rene Tarantino (rene4jazz_at_[hidden])
Date: 2006-07-28 17:30:23


Many thanks Joaquin:

I downloaded the attached file, it works just fine.

* Are you using some using directive? Which one?
The code it's included in a namespace declaration
namespace emedia {
   namespace lumiere {

    /*
       The sample code goes in here
    */

   }
}

----------------------
apart of that there is no added using declaration (except using
boost::multi_index).

* Are you doing some funny thing with the "mem_fun"
identifier inside "Item.h"?
No

* What happens if you fully qualify mem_fun, i.e. if
you write ::boost::multi_index::mem_fun?

Well, when I tried this option it worked!

It looks like gcc missed the "using boost::multi_index" declaration.

In order to gain experience: If you have any idea what was the problem it
will be appreciated.

Thanks again.

René

On 7/28/06, JOAQUIN LOPEZ MU?Z <joaquin_at_[hidden]> wrote:
>
> Rene Tarantino wrote:
> > Hi :
> >
> > I'm just starting to use boost utility library and it
> > seems very promising. I am trying to define a new
> > multi_index type and gcc it's giving me error messages.
> >
> > First I properly added the includes for boost::multi_index :
> >
> > #include <boost/multi_index_container.hpp>
> > #include <boost/multi_index/mem_fun.hpp>
> > #include <boost/multi_index/hashed_index.hpp>
> >
> > then the includes for "Item" and "ObjectId" declarations:
> >
> > #include "Item.h"
> >
> > following that appears this:
> >
> > typedef multi_index_container<
> > Item*,
> > indexed_by<
> > hashed_unique<mem_fun<Item, ObjectId, &Item::getId> >
> > >
> > > ItemsContainer;
> >
> > When I try to compile this code gcc reports the following errors:
> >
> > error: 'mem_fun' was not declared in this scope
> > error: template argument 1 is invalid
> > error: type/value mismatch at argument 3 in template parameter
> > list for 'template<class Arg1, class Arg2, class Arg3, class Arg4>
> > struct boost::multi_index::hashed_unique'
> > error: expected a type, got '&emedia::lumiere::Item::getId'
> > error: template argument 1 is invalid
> > error: template argument 2 is invalid
> > error: expected unqualified-id before '>' token
> >
> > It seems that I'm forgetting something. It's very strange because
> > all ready compilled this code in another project but I can't find
> > any difference with this one.
>
> Hello René,
>
> I really can't reproduce the problem you describe.
> The attached file tries to mimic your scenario (with
> a dummy Item definition) and here everything works OK. Could
> you please try it in your environment?
>
> I guess the problem is not in what you describe, but in what
> you don't, I mean, sorrounding details that you're taking
> for granted. Things to check:
>
> * Are you using some using directive? Which one?
> * Are you doing some funny thing with the "mem_fun"
> identifier inside "Item.h"?
> * What happens if you fully qualify mem_fun, i.e. if
> you write ::boost::multi_index::mem_fun?
>
> I hope some of the above rings a bell for you. Please
> report back. Best,
>
> Joaquín M López Muñoz
> Telefónica, Investigación y Desarrollo
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
>



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