|
Boost Users : |
Subject: Re: [Boost-users] multi index container
From: Alan Tennant (alan2here_at_[hidden])
Date: 2010-02-03 10:10:57
I may be simplifying this a bit. But it sounds like a std::map problem.
hmm, to "a std:: ..." or "an std:: ..."
On 3 February 2010 14:30, Dejan <xamiw_at_[hidden]> wrote:
> Hi all,
>
> I have to store pointer of type (let's say) "employee" in a
> multi-index-container:
>
> struct employee
> {
> employee(int id):id(id){}
> int id;
> };
>
> Further I have to check if every id is unique:
>
> employee* e0 = new employee(1);
> employee* e1 = e0;
> employee* e2 = new employee(1);
> employee* e3 = new employee(2);
>
> my_multi_index_conatiner.insert(e0); // OK
> my_multi_index_conatiner.insert(e1); // BAD
> my_multi_index_conatiner.insert(e2); // BAD
> my_multi_index_conatiner.insert(e0); // OK
>
> Can someone tell me how a typedef of a multi_index_container fullfilling
> prerequisities above looks? Or is a multi_index_container not the right
> tool?
> I've tried with a method in struct employee which returns the
> this-pointer. But this-pointer is const const and useless for my
> problem.
>
> Thanks in advance!
>
> _______________________________________________
> 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