c++ - boost mutable_queue not compiling -
i have managed work through (what appears be) of initial problems, due fact of answers came other people's (unanswered) questions, not sure if heading in right direction. working boost's mutable queue , having issues when compiling.
my code, stands, is:
typedef struct _mycomparator { bool operator() (const prioritystruct* arg1, const prioritystruct* arg2) const { return arg1->key < arg2->key; } } mycomparator; class priorityqueue { typedef prioritystruct* entry; typedef boost::typed_identity_property_map<entry> prop_map; typedef boost::mutable_queue<entry, std::vector<entry>, mycomparator, prop_map> priority_queue_notamb; priority_queue_notamb* pq; boost::mutex mut; public: priorityqueue(void); } priorityqueue::priorityqueue() { pq = new priority_queue_notamb(sizeof(entry)*2, mycomparator(), prop_map()); prioritystruct* ps = new prioritystruct; pq->push(ps); }
when remove final line, pq->push(ps), code compile , run when creating new priorityqueue type. is, errors keep compiling.
and errors are:
1>------ build started: project: priorityqueue, configuration: debug x64 ------ 1> priorityqueue.cpp 1>c:\boost\boost\pending\mutable_queue.hpp(94): error c2679: binary '[' : no operator found takes right-hand operand of type 'priorityqueue::entry ' (or there no acceptable conversion) 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\vector(1119): 'const unsigned __int64 &std::vector<_ty>::operator [](unsigned __int64) const' 1> 1> [ 1> _ty=size_t 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\vector(1135): or 'unsigned __int64 &std::vector<_ty>::operator [](unsigned __int64)' 1> 1> [ 1> _ty=size_t 1> ] 1> while trying match argument list '(std::vector<_ty>, priorityqueue::entry )' 1> 1> [ 1> _ty=size_t 1> ] 1> c:\boost\boost\pending\mutable_queue.hpp(91) : while compiling class template member function 'void boost::mutable_queue<indexedtype,randomaccesscontainer,comp,id>::push(const indexedtype &)' 1> 1> [ 1> indexedtype=priorityqueue::entry, 1> randomaccesscontainer=std::vector<priorityqueue::entry>, 1> comp=mycomparator, 1> id=priorityqueue::prop_map 1> ] 1> priorityqueue.cpp(7) : see reference function template instantiation 'void boost::mutable_queue<indexedtype,randomaccesscontainer,comp,id>::push(const indexedtype &)' being compiled 1> 1> [ 1> indexedtype=priorityqueue::entry, 1> randomaccesscontainer=std::vector<priorityqueue::entry>, 1> comp=mycomparator, 1> id=priorityqueue::prop_map 1> ] 1> priorityqueue.cpp(5) : see reference class template instantiation 'boost::mutable_queue<indexedtype,randomaccesscontainer,comp,id>' being compiled 1> 1> [ 1> indexedtype=priorityqueue::entry, 1> randomaccesscontainer=std::vector<priorityqueue::entry>, 1> comp=mycomparator, 1> id=priorityqueue::prop_map 1> ] ========== build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
any appreciated, have been unable find information on in regards how used.
edit: additional test, added
cout << (pq->empty() ? "yes" : "no") << endl;
to see if strange happened. prints "yes" every time. replaced pq->push this, keep updated note unless receive comment or 2 asking me otherwise readability.
Comments
Post a Comment