I am trying to store objects in a boost multi-index
container.
These objects are all unique can be retrieved by 2 separate keys (unique as well).
namepsace bm = boost::multi_index;
class MyObj {
string strid_;
int32_t numid_;
};
//! associative container searchable by ClOrdId and Sunofia Id.
typedef boost::multi_index_container< MyObj,
bm::indexed_by<
bm::ordered_unique<
bm::member<MyObj,string,&MyObj::strid_>
>,
bm::ordered_unique<
bm::member<MyObj,int32,&MyObj::numid_>
>
>
> Cntr;
Cntr cntr_;
When I try to find any element of that index by integer I use the following code
int32_t to_find = 12;
Cntr::iterator it = cntr_.find(id);
but it doesn't compile and I get the following error
error: invalid conversion from ‘int’ to ‘const char*’
When I use the same code with string it works fine; do you know what I am doing wrong?