| containers/vector-bool/vec-bool-1a.cpp - Another slightly more complicated (almost) equivalent program. | Lecture 6 - slide 15 : 40 Program 1 |
#include <iostream>
#include <vector>
int main(){
using namespace std;
vector<bool> vb;
vb.push_back(true); vb.push_back(true); vb.push_back(false);
vb.push_back(false); vb.push_back(false); vb.push_back(true);
typedef vector<bool>::const_iterator VBI;
cout << boolalpha; // Use a stream manipulator, see The C++ PL (4ed) page 1094.
for(VBI it = vb.begin(); it != vb.end(); it++) cout << *it; // truetruefalsefalsefalsetrue
}