#include "rbtree.h" struct animalcount { string type; // key int count = 0; // value animalcount() : type("") {} animalcount(string t) : type(t) {} bool operator<(const animalcount& other){ return type < other.type; } bool operator>(const animalcount& other){ return type > other.type; } bool operator==(const animalcount& other){ return type == other.type; } }; string to_string(const animalcount& a){ return a.type + ": " + to_string(a.count); } ostream& operator<<(ostream& out, const animalcount& ac){ return out << to_string(ac); } int main(){ Tree counts; counts.insert(animalcount("Rabbit")); counts.insert(animalcount("Mouse")); counts.print_inorder(); counts.search(animalcount("Rabbit")).count += 5; counts.search(animalcount("Mouse")).count += 2; //counts.search(animalcount("Mouse")).name = "Zebra"; // This would cause a problem counts.print_inorder(); return 0; }