3

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

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah, I found that too. I should really read the links I post first :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.