65,209
社区成员
发帖
与我相关
我的任务
分享template<class _Elem,
class _Tr,
class _Alloc>
basic_string<_Elem, _Tr, _Alloc>
to_string(_Elem _E0 = (_Elem)'0',
_Elem _E1 = (_Elem)'1') const
{ // convert bitset to string
basic_string<_Elem, _Tr, _Alloc> _Str;
typename basic_string<_Elem, _Tr, _Alloc>::size_type _Pos;
_Str.reserve(_Bits);
for (_Pos = _Bits; 0 < _Pos; )
if (test(--_Pos))
_Str += _E1;
else
_Str += _E0;
return (_Str);
}