title: C++ unary function for logical true
body: <p>I'm trying to use the any_of function on a vector of bool's.  The any_of function requires a unary predicate function that returns a bool.  However, I can't figure out what to use when the value input into the function is already the bool that I want.  I would guess some function name like "logical_true" or "istrue" or "if" but none of these seem to work.  I pasted some code below to show what I am trying to do.  Thanks in advance for any ideas.
  --Chris</p>
  
  <pre><code>// Example use of any_of function.
  
  #include &lt;algorithm&gt;
  #include &lt;functional&gt;
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  int main(int argc, char *argv[]) {
      vector&lt;bool&gt;testVec(2);
  
      testVec[0] = true;
      testVec[1] = false;
  
      bool anyValid;
  
      anyValid = std::find(testVec.begin(), testVec.end(), true) != testVec.end(); // Without C++0x
      // anyValid = !std::all_of(testVec.begin(), testVec.end(), std::logical_not&lt;bool&gt;()); // Workaround uses logical_not
      // anyValid = std::any_of(testVec.begin(), testVec.end(), std::logical_true&lt;bool&gt;()); // No such thing as logical_true
  
      cout &lt;&lt; "anyValid = " &lt;&lt; anyValid &lt;&lt;endl;
  
      return 0;
  }
  </code></pre>