Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert bitset to string?

Tags:

c++

What is wrong 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

like image 732
mr.bio Avatar asked Dec 21 '25 08:12

mr.bio


1 Answers

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.

like image 137
stefaanv Avatar answered Dec 22 '25 20:12

stefaanv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!