#include <iostream>
#include <vector>
int main()
{
std::vector<double>* data = new std::vector<double> {2, 4, 6, 8, 10, 12, 14, 16, 18, 20};
double a = (*data)[5];
double sameA = data->at(5);
std::cout << a << ", " << sameA << std::endl;
// double b = *data[5]; // Invalid
double* c = &data->at(5);
double* sameC = &data->at(5);
std::cout << c << ": " << *c << ", " << sameC << ": " << *sameC << std::endl;
//double* d = data[5]; // Invalid
delete data;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKaW50IG1haW4oKSAKewoJc3RkOjp2ZWN0b3I8ZG91YmxlPiogZGF0YSA9IG5ldyBzdGQ6OnZlY3Rvcjxkb3VibGU+IHsyLCA0LCA2LCA4LCAxMCwgMTIsIDE0LCAxNiwgMTgsIDIwfTsKCQoJZG91YmxlIGEgPSAoKmRhdGEpWzVdOwoJZG91YmxlIHNhbWVBID0gZGF0YS0+YXQoNSk7CgkKCXN0ZDo6Y291dCA8PCBhIDw8ICIsICIgPDwgc2FtZUEgPDwgc3RkOjplbmRsOwoJCgkvLyBkb3VibGUgYiA9ICpkYXRhWzVdOyAvLyBJbnZhbGlkCgkKCWRvdWJsZSogYyA9ICZkYXRhLT5hdCg1KTsgCglkb3VibGUqIHNhbWVDID0gJmRhdGEtPmF0KDUpOwoJCglzdGQ6OmNvdXQgPDwgYyA8PCAiOiAiIDw8ICpjIDw8ICIsICIgPDwgc2FtZUMgPDwgIjogIiA8PCAqc2FtZUMgPDwgc3RkOjplbmRsOwoJCgkvL2RvdWJsZSogZCA9IGRhdGFbNV07ICAvLyBJbnZhbGlkCgkKCWRlbGV0ZSBkYXRhOwoJCglyZXR1cm4gMDsKfQ==