// problem 1
typename std::map<unsigned int, pkt_entry_t>::iterator it;
//problem 2
std::map<unsigned int, pkt_entry_t>::iterator find(unsigned int a , unsigned int b);
std::map<unsigned int, pkt_entry_t>::iterator find(unsigned int );
}; // end class packet_storage
#endif //end packet_storage_h
i receive errors in line //problem 1 and //problem 2 as follow.
//problem 1 erro:::
type ‘std::map<unsigned int, packet_entry_t<TTileAddress_t>, std::less<unsigned int>, std::allocator<std:air<const unsigned int, packet_entry_t<TTileAddress_t> > > >’ is not derived from type ‘packet_storage<TTileAddress_t>’
//problem 2 error:::
error: type ‘std::map<unsigned int, packet_entry_t<TTileAddress_t>, std::less<unsigned int>, std::allocator<std:air<const unsigned int, packet_entry_t<TTileAddress_t> > > >’ is not derived from type ‘packet_storage<TTileAddress_t>’
CAN ANY BODY TELL ME WHY? AND HOW CAN I SOLVE THE PROBLEM
I SOULD BE GRATEFUL.
THANKS
ATEFE
This compiles, after supplying my own packet_entry_t structure.
Code:
template<class TTileAddress_t>
class packet_storage
{
private:
typedef packet_entry_t<TTileAddress_t> pkt_entry_t;
typedef typename std::map<unsigned int, pkt_entry_t>::iterator iterator_t;
std::map<unsigned int, pkt_entry_t> pkts_map;
public:
packet_storage();
~packet_storage();
// problem 1
typename std::map<unsigned int, pkt_entry_t>::iterator it;
//problem 2
typename std::map<unsigned int, pkt_entry_t>::iterator find(unsigned int a,
unsigned int b);
typename std::map<unsigned int, pkt_entry_t>::iterator find(unsigned int);
}; // end class packet_storage
It mostly needed more 'typename' keywords.
BTW I see no hash map!
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
Bookmarks