#include <iostream>
#include <vector>
#include <string>
#include <limits>
#include <algorithm>
#include <iterator>
using namespace std;
struct Object {
std::string name;
int a;
int b;
int c;
};
class ObjectCollection {
public:
std::vector<Object> collection;
size_t getMaxIndexOfA();
size_t getMaxIndexOfB();
size_t getMaxIndexOfC();
};
size_t ObjectCollection::getMaxIndexOfA() {
return std::distance(collection.begin(), std::max_element(collection.begin(), collection.end(),
[](auto &o1, auto &o2){ return o1.a<o2.a; }));
}
size_t ObjectCollection::getMaxIndexOfB() {
return std::distance(collection.begin(), std::max_element(collection.begin(), collection.end(),
[](auto &o1, auto &o2){ return o1.b<o2.b; }));
}
size_t ObjectCollection::getMaxIndexOfC() {
return std::distance(collection.begin(), std::max_element(collection.begin(), collection.end(),
[](auto &o1, auto &o2){ return o1.c<o2.c; }));
}
int main() {
ObjectCollection c;
c.collection.push_back({"test0" , 1,2,3 });
c.collection.push_back({"test1" , 2,1,4 });
c.collection.push_back({"test2" , 3,1,2 });
cout << c.getMaxIndexOfA() <<" " << c.getMaxIndexOfB() <<" " << c.getMaxIndexOfC() <<endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8bGltaXRzPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8aXRlcmF0b3I+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpzdHJ1Y3QgT2JqZWN0IHsKICAgIHN0ZDo6c3RyaW5nIG5hbWU7CiAgICBpbnQgYTsKICAgIGludCBiOwogICAgaW50IGM7Cn07CgpjbGFzcyBPYmplY3RDb2xsZWN0aW9uIHsKcHVibGljOgogICAgc3RkOjp2ZWN0b3I8T2JqZWN0PiBjb2xsZWN0aW9uOwogICAgc2l6ZV90IGdldE1heEluZGV4T2ZBKCk7CiAgICBzaXplX3QgZ2V0TWF4SW5kZXhPZkIoKTsKICAgIHNpemVfdCBnZXRNYXhJbmRleE9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