[Ndn-interest] Problem with Interest and Data structure in c++

Matteo Bertolino Matteo.Bertolino at eurecom.fr
Tue Sep 20 06:41:09 PDT 2016


Good morning to all,
I write in order to ask your help with a problem.
I would like to do a Map <Interest, int>.

So I wrote:
std::map<Interest, int> myMap;
but each operation on it fails, like:
int numbEntries = mappa.count(nack.getInterest());
or
std::map<Interest,int>::iterator it = mappa.find (nack.getInterest());
or
Interest x: mappa[x] = 5;

The error is always the same:
/usr/include/c++/4.9/bits/stl_function.h:371:20: error: no match for  
‘operator<’ (operand types are ‘const ndn::Interest’ and ‘const  
ndn::Interest’)
        { return __x < __y; }

Then I think to redefine operator "<" into interest.cpp, writing:
bool
   operator<(const ndn::Interest ones, const ndn::Interest other)
   {
     return ones.getName().compare(other.getName())<0;
   }

But, also here, no effect.
Any idea?
Thank you,
Matteo


-------------------------------------------------------------------------------
This message was sent using EURECOM Webmail: http://webmail.eurecom.fr





More information about the Ndn-interest mailing list