|
|
|||
File indexing completed on 2026-04-09 07:49:15
0001 #include "SArr.hh" 0002 #include <iostream> 0003 0004 /** 0005 SArrTest 0006 ========== 0007 0008 Attempting to make a runtime dynamic type like this doesnt work. 0009 The template argument must be known at compile time. 0010 Attemting to do that at runtime gives compilation error:: 0011 0012 non-type template argument is not a constant expression 0013 0014 :google:`C++ runtime dynamically sized type` 0015 0016 **/ 0017 0018 int main(int argc, char** argv) 0019 { 0020 //const unsigned N = argc > 1 ? atoi(argv[1]) : 10 ; // NOPE 0021 const unsigned N = 10 ; 0022 0023 SArr<N>* sa = new SArr<N>() ; 0024 0025 for(unsigned i=0 ; i < N ; i++) sa->values[i] = float(i); 0026 for(unsigned i=0 ; i < N ; i++) std::cout << sa->values[i] << std::endl ; 0027 0028 return 0 ; 0029 }
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|