title: Why vector<bool>::reference doesn't return reference to bool?
body: <pre><code>#include &lt;vector&gt;
  
  struct A
  {
      void foo(){}
  };
  
  template&lt; typename T &gt;
  void callIfToggled( bool v1, bool &amp;v2, T &amp; t )
  {
      if ( v1 != v2 )
      {
          v2 = v1;
          t.foo();
      }
  }
  
  int main()
  {
      std::vector&lt; bool &gt; v= { false, true, false };
  
      const bool f = false;
      A a;
  
      callIfToggled( f, v[0], a );
      callIfToggled( f, v[1], a );
      callIfToggled( f, v[2], a );
  }
  </code></pre>
  
  <p>The compilation of the example above produces next error :  </p>
  
  <pre><code>dk2.cpp: In function 'int main()':
  dk2.cpp:29:28: error: no matching function for call to 'callIfToggled(const bool&amp;, std::vector&lt;bool&gt;::reference, A&amp;)'
  dk2.cpp:29:28: note: candidate is:
  dk2.cpp:13:6: note: template&lt;class T&gt; void callIfToggled(bool, bool&amp;, T&amp;)
  </code></pre>
  
  <p>I compiled using g++ (version 4.6.1) like this :  </p>
  
  <pre><code>g++ -O3 -std=c++0x -Wall -Wextra -pedantic dk2.cpp
  </code></pre>
  
  <p>The question is why this happens? Is <code>vector&lt;bool&gt;::reference</code> not <code>bool&amp;</code>? Or is it a compiler's bug?<br>
  Or, am I trying something stupid? :)</p>