Remember to read the STL specs in relatively plain English on the SGI STL site.
InetTCPSocket is an abstract base class used as in interface. The reason this error was generated was because one function was not declared as abstract, I had forgotten the '= 0' part of the definition.
Another symptom of this is the linker complaining "vtable undefined for class x"
I (PerryLorier) was having a problem after assigning something to a std::map<> the program would crash.
bool operator <(const foo_t &a, const foo_t &b) {
if (a.foo < b.foo) return -1; if (a.foo > b.foo) return 1; return 0;
}
std::map<foo_t,int*> foo_map;
...
foo_map[foo?=new int;
- foo_map[foo?=6;
Note that this is a problem with any sorted sequence. Maps are sorted by key. Sets are also sorted. -- SamJansen
I also recommend adding some assert(3)'s to verify that your operators don't voilate the rules at runtime.
#include <list> #include <algorithm>
int main() {
std::list<int> a; std::list<int> b;
a.push_back(1); !a.push_back(2); !a.push_back(3);
b.push_back(10); b.push_back(20); b.push_back(30);
// Copy 'b' to the end of 'a' std::copy(b.begin(), b.end(), std::back_insert_iterator< std::list<int> >(a));
return 0;
}