I have the following code:
return new std::pair<BST<Data>::iterator(cursor), true>;
This results in the following errors:
could not convert '(operator new(4u), (, ((int*))))' from 'int*' to 'std::pair, bool>'
type/value mismatch at argument 1 in template parameter list for 'template struct std::pair'
What might be the problem here?
Apart from the new (don't use new unless you have to) and return, in order to construct a pair, use either the mentioned make_pair() function or invoke the constructor like this: pair<T1, T2>(v1, v2). You were mixing up the type (pair<T1, T2>) with the values to init that type's instance (v1, v2).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With