fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct example
  5. {
  6. double value_[10];
  7. double& operator [] (int index) {
  8. return value_[index];
  9. }
  10. };
  11.  
  12. int main() {
  13. example e;
  14. e[0] = 2.2;
  15. std::cout << e.value_[0] << std::endl;
  16. }
Success #stdin #stdout 0s 4288KB
stdin
Standard input is empty
stdout
2.2