i have defined an opetarator in class TS booloperator < (TS const & t) const { returnthis->getcoutinuity_counter() < t.getcoutinuity_counter() ;}
this operator < will be use by a set (set <TS>) to create the order thet i need!
exp:
1 2 3
TS* t =TS(w);// w is a parameter
set <TS> sec_ts;
sec_ts.insert(*t);//good the problem is here
so the compiler say and say and say:
1 2 3
/home/sst/tmp/ccZQ4V0x.o: In function `Section::Section(std::set<TS, std::less<TS>, std::allocator<TS> >)':
ff.cpp:(.text._ZN7SectionC1ESt3setI2TSSt4lessIS1_ESaIS1_EE[Section::Section(std::set<TS, std::less<TS>, std::allocator<TS> >)]+0x8): undefined reference to `vtable for Section'
collect2: ld returned 1 exit status
that is this can you explain to me??
that is the TS class if needed:
This makes t a pointer to a TS object. It then attempts to assign that pointer the actual value of the TS object. Unless a TS object can be dynamically cast into a long integer of some sort (and I don't see any way that's gonna happen) this will never compile.
You need to use
1 2 3
TS t (w);
set <TS> sec_ts;
sec_ts.insert (t);
or
1 2 3 4 5 6 7
TS *t = new TS (w);
set<TS> sec_ts;
sec_ts.insert (*t);
...
delete (t); // whenever you are done with it
Hope that'll work for ya, anyway. I haven't actually tried it out myself or anything.
Also assuming you ever write the destructor to free the memory allocated by the constructor, you will need to write a copy constructor and assignment operator.
(The code would compile without writing them, but it would crash).