i have met such a code:
i am wondering the exact use of the "list<intEntry>" and alsoCode:#include<iostream> #include<list> class intEntry {public: intEntry(int a,int b); int add(); private: int addition1; int addition2; }; intEntry::intEntry(int a,int b) { addition1=a; addition2=b; } int intEntry::add() { return a+b; } list<intEntry> & loadIntoTheList(list<intEntry>&p) { for(int i=0;i<10;i++) p.insert(intEntry(i,i+1)) ; }
i get something similar in the hash containers
see the function object
since it is the first time that i use it in my practice ,i cannot be sure about the full use of this kind of the use ,though i have got to know that if it is used i this way it means that it belongs to two kinds of use one it to use as a datatype ,another is to finish the function as it intends to .i want your opinoin,ok? much appreciation !Code:class functionObject { returnType operator()(argement) {....return returnValue;} }
Regards
jolley




Reply With Quote