Nice! const_mem_fun worked in this sample. I will try to port my map to multi_index now and see how it performs.
But, I dont want to give up without understund why mem_fun doesnt work. Anybody has any theory? :D

Thanks Jeff.


On 12/8/06, Jeff F <TriumphSprint2000@hotmail.com> wrote:

"fungos" <fungos@gmail.com> wrote in message
news:e763e59d0612080512k4f02b88cnee2732030a95a5ff@mail.gmail.com...
Well, I still having trouble to get mem_fun working. multi_index accept
boost mem_fn?
Joaquin, the const still wont work. I stripped down the sample to this code:

[code]

#include <boost/multi_index_container.hpp>
#include <boost/multi_index/mem_fun.hpp>
#include <boost/multi_index/ordered_index.hpp>

using boost::multi_index_container;
using namespace ::boost::multi_index;

class Entry
{
        private:
                int size;
        public:
                Entry(int s) : size(s) {}
                int getSize() const { return size; }
};

typedef multi_index_container<
        Entry,
        indexed_by<
                ordered_non_unique<BOOST_MULTI_INDEX_MEM_FUN(Entry,
int, getSize) >  // line 23


Doesn't this work?

    ordered_non_unique< const_mem_fun<Entry,int,&Entry::getSize>
                      >
        >

> EntryCollection;

void main() {
        EntryCollection entries;
        Entry a(3);
        entries.insert(a);  // line 33
}


Jeff Flinn



_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users



--
Animal Frontline Liberation