Boost logo

Boost Users :

Subject: [Boost-users] Boost multiindex: Usage of erase
From: Ramesh (rramesh1_at_[hidden])
Date: 2009-01-05 01:50:28


Hello Joaquin,

I am trying to erase members of a container selectively, I get a
compile error (no matching function found) at the point where I use
erase (highlighted line) below: Could you please point out whats wrong
with the usage?

Thanks
/Ramesh

Here is the code:
-------------

struct MyMap
{
          Adapter *pAdapter;
    unsigned long timestamp;

        MyMap(Adapter * param_Adp, unsigned long param_timestamp ):
                        pAdapter(param_Adp), timestamp(param_timestamp) {}

        ~MyMap(){
                pAdapter = 0;
                timestamp = 0;
        }
};

struct pAdapter{};
struct timestamp{};

typedef multi_index_container<
    MyMap,
        indexed_by <
        ordered_unique<
            tag <pAdapter>, BOOST_MULTI_INDEX_MEMBER(MyMap, Adapter *,
pAdapter) >,
        ordered_unique<
            tag <timestamp>,BOOST_MULTI_INDEX_MEMBER(MyMap, unsigned
long, timestamp) >
>
> tMap;

class ACtr {

        private:
                tMap AContainer;

        public:
                // Constructor
                ACtr();

                //Destructor
                ~ACtr();

                //Remove stale
                bool pruneBad();
};

bool ACtr::pruneBad {

        for ( tMap::index_iterator<timestamp>::type it =
AContainer.get<timestamp>().begin(), it_end =
AContainer.get<timestamp>().end();it != it_end; count++)
        {
                it = AContainer.erase(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