#include <algorithm>
#include <cassert>
#include <functional>
#include <vector>
int main()
{
//Use of C++0x 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]);
}
|