Boost logo

Boost :

Subject: [boost] How to use mutable_queue with non basic types
From: Emili Hernàndez (emilihb_at_[hidden])
Date: 2010-04-09 12:34:19


Hi all,

I've used mutable_queue with basic types (double and int) with no problem.
Now I trying to do it with my own type:

typedef MyObject entry_t;
typedef vector<entry_t> storage_t;
typedef MySortingCriterion comp_t;
typedef boost::identity_property_map prop_map_t;
typedef boost::mutable_queue<entry_t, storage_t, comp_t, prop_map_t>
queue_t;

queue_t Q(100, comp_t(), prop_map_t());

The definition compiles ok but when I perform an operation such

Q.push(obj) //MyObject obj

The following errors appear:

C:\boost\boost_1_42_0/boost/property_map/property_map.hpp: In function
'Reference boost::get(const boost::put_get_helper<Reference,
PropertyMap>&, const K&) [with PropertyMap =
boost::typed_identity_property_map<unsigned int>, Reference = unsigned
int, K = boost::shared_ptr<CAStarNode>]':
C:\boost\boost_1_42_0/boost/pending/mutable_queue.hpp:94: instantiated
from 'void boost::mutable_queue<IndexedType, RandomAccessContainer,
Comp, ID>::push(const IndexedType&) [with IndexedType =
boost::shared_ptr<CAStarNode>, RandomAccessContainer =
std::vector<boost::shared_ptr<CAStarNode>,
std::allocator<boost::shared_ptr<CAStarNode> > >, Comp =
astarnode::SGreater, ID = boost::typed_identity_property_map<unsigned int>]'
..\CAStar.cpp:62: instantiated from here
C:\boost\boost_1_42_0/boost/property_map/property_map.hpp:318: error: no
match for 'operator[]' in '(const
boost::typed_identity_property_map<unsigned int>&)((const
boost::typed_identity_property_map<unsigned int>*)(& pa))[k]'
C:\boost\boost_1_42_0/boost/property_map/property_map.hpp:553: note:
candidates are: T
boost::typed_identity_property_map<T>::operator[](const T&) const [with
T = unsigned int]

It seems the problem is with property_map. Anyone knows how to solve it??

Thank you very much,

Cheers,
Emili


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk