Skip to content

Latest commit

 

History

History
55 lines (30 loc) · 2.21 KB

CppStdLogical_or.md

File metadata and controls

55 lines (30 loc) · 2.21 KB

 

 

 

 

 

 

std::logical_or is a functor that performs a operator|| on two elements.

 


#include <algorithm> #include <cassert> #include <functional> #include <vector> int main() {   //Use of C++11 initializer lists   const std::vector<bool> a = { false, false, true , true };   const std::vector<bool> b = { false, true , false, true };   std::vector<bool> truth_table(4);   std::transform(     a.begin(),     a.end(),     b.begin(),     truth_table.begin(),     std::logical_or;<bool>());   assert(a[0] || b[0] == truth_table[0]);   assert(a[1] || b[1] == truth_table[1]);   assert(a[2] || b[2] == truth_table[2]);   assert(a[3] || b[3] == truth_table[3]); }

 

 

 

 

 

External links