bitset崩溃
byte testBytes[5]={0x1,0x2,0x3,0x4,0x0}; //vc环境下
std::string strHelp((char*)testBytes);
#if 1
int nTemp=strHelp.length(); //nTemp==4 ?
#endif
std::bitset<40> temp2(strHelp); //崩溃
template<class _Elem,
class _Tr,
class _Alloc>
explicit bitset(const basic_string<_Elem, _Tr, _Alloc>& _Str,
_BITSET_SIZE_TYPE _Pos = 0)
{ // construct from [_Pos, ...) elements in string
_Construct(_Str, _Pos,
basic_string<_Elem, _Tr, _Alloc>::npos, (_Elem)'0');
}
最终导致
void _Xinv() const
{ // report invalid string element in bitset conversion
_THROW(invalid_argument, "invalid bitset<N> char");
}
抛出异常
需求: 用bitset模版类去操作字节数组testBytes!
std::string strHelp((char*)testBytes);
#if 1
int nTemp=strHelp.length(); //nTemp==4 ?
#endif
std::bitset<40> temp2(strHelp); //崩溃
template<class _Elem,
class _Tr,
class _Alloc>
explicit bitset(const basic_string<_Elem, _Tr, _Alloc>& _Str,
_BITSET_SIZE_TYPE _Pos = 0)
{ // construct from [_Pos, ...) elements in string
_Construct(_Str, _Pos,
basic_string<_Elem, _Tr, _Alloc>::npos, (_Elem)'0');
}
最终导致
void _Xinv() const
{ // report invalid string element in bitset conversion
_THROW(invalid_argument, "invalid bitset<N> char");
}
抛出异常
需求: 用bitset模版类去操作字节数组testBytes!
...全文
相关推荐
C++库函数查询手册
C++库函数查询手册 C++库函数查询手册
C++ Standard Library, The: A Tutorial and Reference
C++ Standard Library, The: A Tutorial and Reference Nicolai M. Josuttis Publisher: Addison Wesley
《C++标准程序库》 简体中文 pdf电子书
《C++标准程序库》 简体中文 pdf电子书 ! 侯捷译!
全国计算机等级考试二级Java上机真题南开一百题.pdf
全国计算机等级考试二级Java上机真题南开一百题.pdf
C++ primer学习笔记一
C++ primer前十章的学习笔记,看对大家有用么


