I'm writing a program for a college exercise and I'm not sure about find()
. I must enter two integers, check if the first number exists within the set
already defined previously. If it exists, I should insert the second integer in set
.
Then I did:
cin >> valor >> valord;
if (di.find(valor))
di.insert(valor);
Where di
is my set
defined already with filled values.
You are giving the following error:
[Error] could not convert 'di.std :: set > find, std :: allocator> (( (const key_type ) (& value ) ')' from 'std :: set :: iterator {aka std :: _ Rb_tree_const_iterator}' to 'bool'
Can anyone explain to me if the function find
returns true
or false
?