#include <iostream>
#include <vector>
template <typename T>
struct wrapper
{
wrapper<T>* operator ->() { return this; }
std::vector<T>& myvec;
};
template <typename T>
class B
{
public:
std::vector<T> data;
B(const std::vector<T>& init) : data(init) {}
wrapper<T> operator -> () { return {data}; }
};
int main()
{
B<double> obj({1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0});
obj->myvec[4] = -obj->myvec[4];
for (const auto& d : obj->myvec) {
std::cout << d << std::endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKdGVtcGxhdGUgPHR5cGVuYW1lIFQ+CnN0cnVjdCB3cmFwcGVyCnsKICAgIHdyYXBwZXI8VD4qIG9wZXJhdG9yIC0+KCkgeyByZXR1cm4gdGhpczsgfQogICAgCiAgICBzdGQ6OnZlY3RvcjxUPiYgbXl2ZWM7Cn07Cgp0ZW1wbGF0ZSA8dHlwZW5hbWUgVD4KY2xhc3MgQgp7CnB1YmxpYzoKICAgIHN0ZDo6dmVjdG9yPFQ+IGRhdGE7CgogICAgQihjb25zdCBzdGQ6OnZlY3RvcjxUPiYgaW5pdCkgOiBkYXRhKGluaXQpIHt9CgogICAgd3JhcHBlcjxUPiBvcGVyYXRvciAtPiAoKSB7IHJldHVybiB7ZGF0YX07IH0KICAgIAp9OwoKaW50IG1haW4oKQp7CiAgICBCPGRvdWJsZT4gb2JqKHsxLjAsMi4wLDMuMCw0LjAsNS4wLDYuMCw3LjAsOC4wLDkuMCwxMC4wfSk7CgogICAgb2JqLT5teXZlY1s0XSA9IC1vYmotPm15dmVjWzRdOwogICAgCiAgICBmb3IgKGNvbnN0IGF1dG8mIGQgOiBvYmotPm15dmVjKSB7CiAgICAgICAgc3RkOjpjb3V0IDw8IGQgPDwgc3RkOjplbmRsOwogICAgfQp9