4
I’m writing a little program for a college exercise and I’m having second thoughts about find()
. I must enter two integer numbers, check if the first number exists within the set
previously defined. If it exists, I must insert the second integer in the set
.
So I did:
cin >> valor >> valord;
if (di.find(valor))
di.insert(valor);
Where di
is mine set
defined with values already filled.
You’re making the following mistake:
[Error] could not Convert 'di.Std::set<_Key, _Compare, _Alloc>::find, Std::allocator >(((const key_type)(& value))'from 'Std::set::iterator {aka Std::_Rb_tree_const_iterator}' to 'bool'
Could someone explain to me if the function find
returns true
or false
?
Thank you very much !!
– mahatt
@mahatt see on [tour] the best way to say thank you.
– Maniero