|
Boost Users : |
Subject: Re: [Boost-users] multi index container [solved]
From: Dejan (xamiw_at_[hidden])
Date: 2010-02-03 13:23:29
> That's right, but did you consider what I commented in my
> previous post?
>
Yeah, I did but the variable id is coming from outside (user) and not
from inside (software). So p->id is never used.
The user can enter any kind of id (e.g. non-existend id) and with this
id the object is found (or not found) and edited (by the user).
The software uses pointer to find the variable if something inside
changes. E.g. a member inside a object changes (by usage of a pointer
outside the object). This member will notify all objects where it is a
member (via pointer).
But I have again a problem. I can't get the member variable (like id in
this example) directly. I have to use get_id(). When defining:
typedef multi_index_container
<
employee*,
indexed_by
<
ordered_unique<identity<employee*> >,
// next line does not work
ordered_unique<member<employee, int, &employee::get_id()> >
>
> employee_set;
The code does not compile:
error: âEmployee::get_id() constâ cannot appear in a constant-expression
error: a function call cannot appear in a constant-expression
How can I fix it?
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