C++ - Alphabetizing Strings -


i reading information input file. of information, there name. information read struct. there array of these structs.

i need alphabetize structs last name, using binary search tree.

do need write operator overload function ==, <, , >. if can me started on that?

operator overloads work functions or methods. return type , arguments in same way. instance, binary operator (like <) member function 1 argument or free function two, 1 each each side of operator. thing that's different instead of having identifier function name, use special syntax, keyword operator followed operator being overloaded. if wanted have comparable type, way:

class myusertype {   private:     std::string sort_significant;     std::string sort_insignificant;   public:     bool operator<(const myusertype &) const; };  bool myusertype::operator<(const myusertype & other) const {    return sort_significant < other.sort_significant; } 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -