“bit_vector”: 未声明的标识符 VS2010解决方案

来源:互联网 发布:java md5加密 32位 编辑:程序博客网 时间:2024/05/21 17:24

VS2010中并不能直接使用bit_vector命名变量,需使用_Bvector来定义,下面是一个简单的遍历:

#include <vector>
#include <iostream>
using namespace std;


int main(void)
{
_Bvector bv;
bv.push_back(false);
bv.push_back(false);
bv.push_back(true);
bv.push_back(true);


_Bvector bv2(7);
bv2[0]=true;
bv2[1]=false;
bv2[2]=true;


_Bvector::iterator i,iend;
iend=bv.end();
for (i=bv.begin();i!=iend;i++)
{
cout<<*i?'1':'0'<<' ';
cout<<endl;
}
system("pause");
return 0;
}