title: C++ Struct in 'n' Dimensions
body: <p>I am working on a series of problems in higher dimensionality, and was hoping someone could offer me some broad advice:</p>
  
  <p>Consider a struct representing a point in two (2) dimensions:</p>
  
  <pre><code>struct p2 {
      double x, y;
      p2(double x, double y) : x(x),y(y){}
  };
  </code></pre>
  
  <p>This point can be easily extended to three (3) dimensions:</p>
  
  <pre><code>struct p3 : p2 {
      double z;
      p3(double x, double y, double z) : p2(x,y),z(z){}
  };
  </code></pre>
  
  <p>But how do you handle the case for 'n' dimensions, where the n could be 4, 5, 6, or anything higher for that matter, and only known at runtime. In other words, the user might supply 2D data, or 3D or 4D etc...</p>
  
  <p>I am open to other solutions other than C++, however, assume this a numerically intense problem, and therefore functional and/or scripting languages should probably be avoided.</p>