Convert bits to string?

What is wrong with this code?

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

error: there is no corresponding function to call on `std :: bitset <3u> :: to_string () '

why?!

UPDATE:

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

+3
source share
1 answer

Checking the answer of Space_COwbOy, I found another page that shows that to_string is a template function (with options similar to std :: basic_string). I have not tried this, so just check it out.

+5
source

Source: https://habr.com/ru/post/1739140/


All Articles