Error compiling c++ application

E

Einat d

Does anyone know how to deal with the following error:

"ClsGetAllRepository.cpp", line 158: Error: Could not find a match for
std::multimap<RssLocalRepository::ClsRssObject*,
RssLocalRepository::ClsRssUser*,
RssLocalRepository::ClsGetAllRepository::RssObjectPtrCompare,
std::allocator<std::pair<RssLocalRepository::ClsRssObject*const,
RssLocalRepository::ClsRssUser*>>>::insert(std::pair<RssLocalRepository::ClsRssObject*,
RssLocalRepository::ClsRssUser*>).
 
I

Ivan Vecerina

| Does anyone know how to deal with the following error:
|
| "ClsGetAllRepository.cpp", line 158: Error: Could not find a match for
| std::multimap<RssLocalRepository::ClsRssObject*,
| RssLocalRepository::ClsRssUser*,
| RssLocalRepository::ClsGetAllRepository::RssObjectPtrCompare,
| std::allocator<std::pair<RssLocalRepository::ClsRssObject*const,
|
RssLocalRepository::ClsRssUser*>>>::insert(std::pair<RssLocalRepository::Cls
RssObject*,
| RssLocalRepository::ClsRssUser*>).

It would help if you posted at least the line of code that triggered the
error,
and some surrounding code, if not a complete file.

You might need to explicitly specify the type of the parameter to a call to
MyMap::insert().
E.g.:
myMapVar.insert(MyMap::value_type(objPtr,userPtr))
instead of:
myMapVar.insert(std::make_pair(objPtr,userPtr))

But this is a wild guess given the amount of information you provided...

hth
 
E

Einat d

Here is the code that generated the error:

void ClsGetAllRepository::InsertConnection(
const ClsRssObject &group,
const ClsRssUser &user
)
{
// first we insert the user to users pool and the group to the group
pool
RssObjectPoolInsertionPair groupInserPair =
m_groupPool.insert(group);
RssUserPoolInsertionPair userInserPair = m_userPool.insert(user);

m_connectionPool.insert(std::make_pair(&*groupInserPair.first,

&*userInserPair.first));
}

The last line is the source of the message.

Here is a portion of the H file definition:

ConnectionPool m_connectionPool;

typedef allocator<pair<RssLocalRepository::ClsRssObject*,RssLocalRepository::ClsRssUser*
typedef multimap<ClsRssObject*,
ClsRssUser*,
RssObjectPtrCompare,
ConnectionAllocator > ConnectionPool;

Is there anything else I can post ?
 
I

Ivan Vecerina

Hi Einat,
| typedef multimap<ClsRssObject*,
| ClsRssUser*,
| RssObjectPtrCompare,
| ConnectionAllocator > ConnectionPool;
|
| Is there anything else I can post ?

Have you tried the fix I suggested in my previous post:
myMapVar.insert(MyMap::value_type(objPtr,userPtr))

Specifically, based on the code you've now posted,
replace:
| m_connectionPool.insert(std::make_pair(
| &*groupInserPair.first, &*userInserPair.first));

with:
m_connectionPool.insert(ConnectionPool::value_type(
&*groupInserPair.first, &*userInserPair.first));

Even if this doesn't work, it should at least provide
you with a somewhat easier error message.


You always need to be careful with std::make_pair,
because subtle differences in the template parameters
of std::pair can create incompatible types.

In your library implementation, I think the map template
implicitly adds a const on the first type (which is
correct, though debated). And this might be causing
the error...


I hope this helps,
Ivan
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top