arr[] has nodes for a tree and I order elements based on the size of subtree from the nodes.
After inserting some values, the set is ordered properly.
But when I erase some value it does not happen.
par is an integer value present in the set
1 2
v.erase(v.find(par)); // gives segmentation fault
v.erase(par); // does not give an error but the value is not deleted from the vector. it is again considered while traversing the set later.
There are elements having same value of size
if I use less-than then equal elements are not inserted
Currently my program crashes on erase, not on insertion.
If I use the second erase instruction I have written above, then why doesn't it delete.
In a BST, it can search for the element whether <= is employed or simple <
There are elements having same value of size
if I use less-than then equal elements are not inserted
Then you need another criteria.
To compare elements for equality it uses the relationship not less(a,b) and not less(b,a) -> equal(a,b)
The function that you are using would never evaluate that as true, so find() always return end()
OK thanks
that means I can not compare elements in a set on the basis of a criterion that gives equal values for two elements?
Any suggestions on which STL container can I use if I have to use this criterion only.
I have created my own implementation of tree but just want to know if I can use any STL container for the same