Boost logo

Boost Users :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2006-07-28 16:33:49


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 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