开发者

convert bitset to string?

开发者 https://www.devze.com 2022-12-24 22:23 出处:网络
What is w开发者_开发知识库rong with this code ? set<string> nk ; bitset<3> bs1(string(\"100\"));

What is w开发者_开发知识库rong with this code ?

set<string> nk ;
bitset<3> bs1(string("100"));
nk.insert(bs1.to_string());

error: no matching function for call to `std::bitset<3u>::to_string()'

why?!

UPDATE :

Thansk , this works . But why does it work ? :D


While checking Space_COwbOy's answer, I found another page that shows that to_string is a template function (with parameters similar to std::basic_string). I haven't tried this, so just check it out.

0

精彩评论

暂无评论...
验证码 换一张
取 消