title: Emacs indentation support for C++11 syntax?
body: <p>Now that C++11 is out, I wondered if there are any tips on improving indentation support in Emacs when more and more code is migrated from C++98 to C++11.</p>
  
  <p>Examples:</p>
  
  <ul>
  <li>Parentheses are <a href="https://akrzemi1.wordpress.com/2011/06/29/brace-brace/" rel="noreferrer">often becoming braces</a>, which seem to confuse Emacs.</li>
  <li><a href="http://msdn.microsoft.com/en-us/library/vstudio/dd293603.aspx" rel="noreferrer">Lambda expressions</a> are not well supported yet</li>
  <li><a href="https://en.wikipedia.org/wiki/C++11#Alternative_function_syntax" rel="noreferrer">Trailing type function declarations</a> (cannot comment, as I have not used them)</li>
  <li><a href="https://en.wikipedia.org/wiki/Variadic_Templates" rel="noreferrer">Variadic templates</a> (though personally, I had no problem with them so far)</li>
  </ul>
  
  <p>Here are some questionable indentions that I find myself working around:</p>
  
  <pre><code>struct m {
      int a;
      char b;
  };
  
  std::vector&lt;m&gt; foo { {1, 'a'},
          {2, 'b'},
              { 3, 'c'},
                  { 4, 'd' }};
  </code></pre>
  
  <p>I'd prefer</p>
  
  <pre><code>std::vector&lt;m&gt; foo { {1, 'a'},
                       {2, 'b'},
                       { 3, 'c'},
                       { 4, 'd' }};
  </code></pre>
  
  <p>or even</p>
  
  <pre><code>std::vector&lt;m&gt; foo { {1, 'a'},
          {2, 'b'},
          { 3, 'c'},
          { 4, 'd' }};
  </code></pre>
  
  <p>for example.</p>
  
  <p>Next one:</p>
  
  <pre><code>cout &lt;&lt; 5
       &lt;&lt; [](int a) {
      return 2 * a;
  } (5);
  </code></pre>
  
  <p>I'd prefer</p>
  
  <pre><code>cout &lt;&lt; 5
       &lt;&lt; [](int a) {
              return 2 * a;
          } (5);
  </code></pre>
  
  <p>so that the block is indented relative to the lambda.</p>
  
  <p>I find myself spending more time on indentation, which is annoying.</p>
  
  <p><strong>Are any packages or customizations that help to indent modern C++11 code?</strong></p>
  
  <p>(side note: I set up <a href="http://clang.llvm.org/docs/ClangFormat.html" rel="noreferrer">clang-format</a> for Emacs, but I cannot get 100% compatibility which existing code and it also does not yet understand C++11 syntax very well. Still it is useful sometimes and sounds like a good idea for new projects.)</p>