fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct _sin_temp {
  5. constexpr static unsigned SIN_ARRAY_MAX=12345;
  6. constexpr _sin_temp() : arr() {
  7. for (unsigned i = 0; i != SIN_ARRAY_MAX; ++i)
  8. arr[i] = 0xfffe*i/SIN_ARRAY_MAX;
  9. }
  10. constexpr uint16_t operator[] (unsigned i) const {return arr[i];}
  11. uint16_t arr[SIN_ARRAY_MAX];
  12. };
  13.  
  14. constexpr static const _sin_temp sin_array=_sin_temp();
  15.  
  16. constexpr uint16_t test=sin_array[12];
  17.  
  18. int main() {
  19. cout<<test<<endl;
  20. // your code goes here
  21. return 0;
  22. }
Success #stdin #stdout 0s 4232KB
stdin
Standard input is empty
stdout
63