title: Why aren't named parameters used more often?
body: <p>I have designed a parameter class which allows me to write code like this:</p>
  
  <pre><code>//define parameter
  typedef basic_config_param&lt;std::string&gt; name;
  
  void test(config_param param) {
  
    if(param.has&lt;name&gt;()) { //by name
      cout &lt;&lt; "Your name is: " &lt;&lt; param.get&lt;name&gt;() &lt;&lt; endl;
    }
  
    unsigned long &amp; n = param&lt;ref&lt;unsigned long&gt; &gt;(); //by type
    if(param.get&lt;value&lt;bool&gt; &gt;(true)) { //return true if not found
      ++n;
    }
  }
  
  
  unsigned long num = 0;
  test(( name("Special :-)"), ref&lt;unsigned long&gt;(num) )); //easy to add a number parameter
  cout &lt;&lt; "Number is: " &lt;&lt; num; //prints 1
  </code></pre>
  
  <p>The performance of the class is pretty fast: everything is just a reference on the stack. And to save all the information I use an internal buffer of up to 5 arguments before it goes to heap allocation to decrease the size of every single object, but this can be easily changed.</p>
  
  <p>Why isn't this syntax used more often, overloading <code>operator,()</code> to implement named parameters? Is it because of the potential performance penalty?</p>
  
  <p>One other way is to use the named idiom:</p>
  
  <pre><code>object.name("my name").ref(num); //every object method returns a reference to itself, allow object chaining.
  </code></pre>
  
  <p>But, for me, overloading <code>operator,()</code> looks much more "modern" C++, as long you don't forget to uses double parentheses. The performance does not suffer much either, even if it is slower than a normal function, so is it negligible in most cases. </p>
  
  <p>I am probably not the first one to come up with a solution like this, but why isn't it more common? I have never seen anything like the syntax above (my example) before I wrote a class which accepts it, but for me looks it perfect.</p>