title: dangling if and macro
body: <p>I'm in the need to get rid of warnings, one of it is a -Wdangling-else. It notes a dangling if inside the following macro definition:</p>
  
  <pre><code>#define FOR_EACH_REF(var, container) \
      if(bool _cont = true) \
        for(our::remove_reference&lt;decltype(container)&gt;::type::iterator _it = (container).begin(); _it != (container).end() &amp;&amp; _cont; ++_it) \
          if((_cont = false)) {} else \
            for(our::remove_reference&lt;decltype(container)&gt;::type::value_type&amp; var = *_it; !_cont; _cont = true)
  </code></pre>
  
  <p>I must admit, I do not really get into this macro and thus do not know, how to resolve this warning.</p>
  
  <p>Could anyone help me with an explanation on how to avoid the dangling else?</p>