title: Ternary operator + C++11 constructor from initializer_list
body: <p>While developing an application, I had the following problem. I wanted to return an empty <code>std::list&lt;string&gt;</code> when a given function pointer was null, or the result of that function otherwise. This is a simplified version of my code:</p>
  
  <pre><code>typedef std::list&lt;std::string&gt; (*ParamGenerator)();
  
  std::list&lt;std::string&gt; foo() {
      /* ... */
      ParamGenerator generator = ...;
      if(generator)
          return generator();
      else
          return {};
  }
  </code></pre>
  
  <p>However, I usually like to use the ternary (<code>?:</code>) operator in these cases, so I tried using it this way (as usual):</p>
  
  <pre><code>return generator ? generator() : {};
  </code></pre>
  
  <p>But got this error:</p>
  
  <pre><code>somefile.cpp:143:46: error: expected primary-expression before ‘{’ token
  somefile.cpp:143:46: error: expected ‘;’ before ‘{’ token
  </code></pre>
  
  <p>Does this mean I can't use the ternary operator to return objects created using their constructor from an <code>initializer_list</code>? Is there any particular reason for that? </p>