Trolls have testicles.°°
Simple Inheritance
Posts
-
So you think you can tell -
Space is BigMakes me think the lack of water in the universe is dismal. X|
-
sorting an STL list of =references= to objectsBUG: The STL list::sort() Function Doesn't Sort a List of Pointers http://support.microsoft.com/default.aspx?scid=kb;EN-US;q265109 The Standard Template Library (STL) list::sort function doesn't sort a list of pointers when a predicate function is defined for sorting. VC6 is a ten-year old compiler now. The bug is not present in VC2008 or MinGW. Your code is implemented below with the workaround described in KB265109. ________________________________________________________________________________________ #include <iostream> #include <string> #include <list> using namespace std; struct pstchip_pin_wor { string primitive; string pin_name; string pin_number; pstchip_pin_wor( string aa, string bb, string cc) { primitive = aa; pin_name = bb; pin_number = cc; } pstchip_pin_wor& pstchip_pin_wor::operator= (const pstchip_pin_wor &itemToCopy) { if(&itemToCopy != this) { this->primitive = itemToCopy.primitive; this->pin_name = itemToCopy.pin_name; this->pin_number = itemToCopy.pin_number; } return *this; } int pstchip_pin_wor::operator == ( const pstchip_pin_wor& itemToCompare) const { if( this->primitive == itemToCompare.primitive && this->pin_name < itemToCompare.pin_name ) return 1; return 0; } int pstchip_pin_wor::operator < ( const pstchip_pin_wor&
-
sorting an STL list of =references= to objectsYou fattened the parameters of compareFunc with const specifiers. It works when you remove them. If you want to define compareFunc with const parameters:
static bool compareFunc( const pstchip_pin_wor* a, const pstchip_pin_wor* b)
then you have to define the operator < as a const member:
bool operator < ( const pstchip_pin_wor& itemToCompare) const
modified on Wednesday, December 2, 2009 5:13 PM
-
sorting an STL list of =references= to objectsIf you really need to maintain a list of pointers, you can add one user-defined function (as global or as static member to the class) that compares two objects with pointers to them as parameters.
static bool less_than(pstchip_pin_wor* elem1, pstchip_pin_wor* elem2)
{
return *elem1 < *elem2;
}Then you use the sort with the user-defined function as parameter.
wors_pstchip_pins.sort(pstchip_pin_wor::less_than);
-
IDEhan. Qt Creator, Codelite, Anjuta or code:block. Monodevelop can be used as a editor. Thank you.
-
It is a girl !That's very mean. There are efficient ways to control child development now. Even later, it is possible to do much if desired. At any rate, it can look like a duck, it can quack like a duck, it's still a hen if it drops eggs. There are always men whom would be made happy.
-
C++ Anyone?That is what I will do. You feel part of some sort of nobility (albeit recognized only by your peers) when you can run the whole gamut of ATL, WTL, STL. It's the .Net Framework that killed C++ on Windows and only the framework. If librairies as complete and unified could enter the arena, the language would be revived by popular demand. But I am pessimistic. Nevertheless, although a chilly pain since its inception due to the asinian lack of librairies, C++ is still firmly anchored. It ages well and it remains definitely OK for cross-platform development (wxWidgets, Qt and others ...).
-
Hardware server monitor?I agree that the device is not that affordable. If you want to monitor from another computer, you can perform a remote monitoring of, for example, the "System" process of the monitored machine or an application of your own if required. This is possible with the Services API or via WMI (not exhaustive). Once sure that the OS is not responding, you can send a +5V signal using a data acquisition card on the monitoring machine and two wires plugged to the reset connector. Maybe I missed something ...
-
Hardware server monitor?http://www.sophisticated.com/products/kick-off/kick-off.html Hope it helps ...
-
Iraq vs. Irak questionEverything is correct in all languages. Arabic names use arabic alphabet and characters, so each country with an other alphabet defines proprietary rules for the transcription, mainly in an effort to restitute pronunciation, marginaly by following old habits of writing. This is the same for russian or chinese, but also many others languages. So in french/english: Irak - Iraq Bagdad - Baghdad Bassorah - Basra Chiites - Shiahs Pékin - Beijing Moscou - Moskow There are exemples where history brought totally different names for same places: ex: english/german/french Germany / Deutchland / Allemagne In general, I remarked that english strips a lot, while french fattens.