Fix value_type definition of std::map. (#186)

Has to be std::pair<const Key, T>
This commit is contained in:
Manuel Mausz 2017-02-17 13:36:10 +01:00 committed by vitalyster
parent ea86a790d6
commit f916febf5d
3 changed files with 9 additions and 9 deletions

View file

@ -44,7 +44,7 @@ class RosterStorage;
/// Manages roster of one XMPP user.
class RosterManager {
public:
typedef std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<std::string, Buddy *> > > BuddiesMap;
typedef std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<const std::string, Buddy *> > > BuddiesMap;
/// Creates new RosterManager.
/// \param user User associated with this RosterManager.
/// \param component Transport instance associated with this roster.
@ -121,7 +121,7 @@ class RosterManager {
void sendUnavailablePresences(const Swift::JID &to);
protected:
std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<std::string, Buddy *> > > m_buddies;
std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<const std::string, Buddy *> > > m_buddies;
private:
Component *m_component;

View file

@ -59,7 +59,7 @@ RosterManager::~RosterManager() {
sendUnavailablePresences(m_user->getJID().toBare());
for (std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<std::string, Buddy *> > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) {
for (std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<const std::string, Buddy *> > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) {
Buddy *buddy = (*it).second;
if (!buddy) {
continue;
@ -365,7 +365,7 @@ void RosterManager::setStorageBackend(StorageBackend *storageBackend) {
Swift::RosterPayload::ref RosterManager::generateRosterPayload() {
Swift::RosterPayload::ref payload = Swift::RosterPayload::ref(new Swift::RosterPayload());
for (std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<std::string, Buddy *> > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) {
for (std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<const std::string, Buddy *> > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) {
Buddy *buddy = (*it).second;
if (!buddy) {
continue;
@ -381,7 +381,7 @@ Swift::RosterPayload::ref RosterManager::generateRosterPayload() {
}
void RosterManager::sendCurrentPresences(const Swift::JID &to) {
for (std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<std::string, Buddy *> > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) {
for (std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<const std::string, Buddy *> > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) {
Buddy *buddy = (*it).second;
if (!buddy) {
continue;
@ -416,7 +416,7 @@ void RosterManager::sendCurrentPresence(const Swift::JID &from, const Swift::JID
}
void RosterManager::sendUnavailablePresences(const Swift::JID &to) {
for (std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<std::string, Buddy *> > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) {
for (std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<const std::string, Buddy *> > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) {
Buddy *buddy = (*it).second;
if (!buddy) {
continue;

View file

@ -208,7 +208,7 @@ void XMPPRosterManager::handleRemoteRosterResponse(SWIFTEN_SHRPTR_NAMESPACE::sha
//If we receive empty RosterPayload on login (not register) initiate full RosterPush
if(!m_buddies.empty() && payload->getItems().empty()){
LOG4CXX_INFO(logger, "Received empty Roster upon login. Pushing full Roster.");
for(std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<std::string, Buddy *> > >::const_iterator c_it = m_buddies.begin();
for(std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<const std::string, Buddy *> > >::const_iterator c_it = m_buddies.begin();
c_it != m_buddies.end(); c_it++) {
sendBuddyRosterPush(c_it->second);
}
@ -250,7 +250,7 @@ void XMPPRosterManager::sendRIE() {
// fallback to normal subscribe
if (jidWithRIE.empty()) {
for (std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<std::string, Buddy *> > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) {
for (std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<const std::string, Buddy *> > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) {
Buddy *buddy = (*it).second;
if (!buddy) {
continue;
@ -261,7 +261,7 @@ void XMPPRosterManager::sendRIE() {
}
Swift::RosterItemExchangePayload::ref payload = Swift::RosterItemExchangePayload::ref(new Swift::RosterItemExchangePayload());
for (std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<std::string, Buddy *> > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) {
for (std::map<std::string, Buddy *, std::less<std::string>, boost::pool_allocator< std::pair<const std::string, Buddy *> > >::iterator it = m_buddies.begin(); it != m_buddies.end(); it++) {
Buddy *buddy = (*it).second;
if (!buddy) {
continue;