title: How to create an unbounded set of differently named methods matching some patterns which can be called up on demand in C++?
body: <p>Currently I'm transferring from python to C++, I want to create an unbounded set of functions with which I could call on demand:</p>
  <pre><code>namespace funcs1 {
      int get_1() {return 1;}
      int get_2() {return 2;}
      //...
  }
  
  //could also be
  
  class funcs2 {
      static int get_1() {return 1;}
      static int get_2() {return 2;}
      //...
  }
  
  int main() {
     funcs1::get_123456789(); //return 123456789
     funcs2::get_123456789(); //return 123456789
     return 0;
  }
  </code></pre>
  <p>Since <code>x</code> in <code>get_x()</code> could be arbitraily large, I can't just create unbounded number of functions. In python, things can be done by:</p>
  <pre class="lang-py prettyprint-override"><code>class FuncsMeta(type):
  
      def __getattr__(_, key):
          def f():
              return int(key.split('_')[1])
          return f
      
  class Funcs(metaclass=FuncsMeta):
      pass
      
  
  assert funcs.get_123456789() == 123456789
  </code></pre>
  <p>I'm wondering how to do this in C++. :)</p>