Usin transform in Map

H

hyderabadblues

Hi ,

I am trying to insert few elements of type
midw_fi_tcl_AuxCtrlExt_MPItemDetail with integer as key in to a map
using transform funtion, I am getting the following error

transform( oIndex.begin(), oIndex.end(), poBrowseInfo-
BrowseInfo.MPItemDetail.begin(), inserter(*m_poDataMap,
(*m_poDataMap).end()), bpstl::make_pair< tU32,
bpstl::vector<midw_fi_tcl_AuxCtrlExt_MPItemDetail > >);



Error #312: no suitable user-defined conversion from
"vector<midw_fi_tcl_AuxCtrlExt_MPItemDetail,
allocator<midw_fi_tcl_AuxCtrlExt_MPItemDetail>>::value_type" to "const
vector<midw_fi_tcl_AuxCtrlExt_MPItemDetail,
allocator<midw_fi_tcl_AuxCtrlExt_MPItemDetail>>" exists

How can I solve this problem
 
A

Alf P. Steinbach

* hyderabadblues:
I am trying to insert few elements of type
midw_fi_tcl_AuxCtrlExt_MPItemDetail

C++ namespaces can help you avoid unreadable and overspecific names like
that.

with integer as key in to a map
using transform funtion, I am getting the following error

transform( oIndex.begin(), oIndex.end(), poBrowseInfo->
BrowseInfo.MPItemDetail.begin(), inserter(*m_poDataMap,
(*m_poDataMap).end()), bpstl::make_pair< tU32,
bpstl::vector<midw_fi_tcl_AuxCtrlExt_MPItemDetail > >);

Don't know about you, but to me that's unreadable.

Error #312: no suitable user-defined conversion from
"vector<midw_fi_tcl_AuxCtrlExt_MPItemDetail,
allocator<midw_fi_tcl_AuxCtrlExt_MPItemDetail>>::value_type" to "const
vector<midw_fi_tcl_AuxCtrlExt_MPItemDetail,
allocator<midw_fi_tcl_AuxCtrlExt_MPItemDetail>>" exists

How can I solve this problem

The error message says you're using a vector<...>::value_type where a
vector<...> is expected.

Presumably *oIndex.begin() yields instance of vector<...>::value_type.

Resolution depends on what you want, do you want to insert
vector<...>::value_type or vector<...>?


Cheers, & hth.,

- Alf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,967
Members
47,518
Latest member
RomanGratt

Latest Threads

Top