I am getting an error cannot convert argument 1 from 'Cars*' to 'const Cars&', for the following snippet.. Cant we send pointer to a function contains const ref as argument?
p = &x is a pointer: the address-of operator.
type &x = value is a reference.
cars& object is a reference parameter , not a pointer.
cars *object would be a pointer.
so call it with
*objectlist.find(something) etc ... get a value out of the set, that is a pointer, dereference it (the * in front) and its a thing again, which is what the function wants.
The problem is not const. The problem is that you're trying to pass a Cars pointer to a function that expects a Cars reference. What you need to do is to use the * operator on the pointer. That'll give you a reference to the object that the pointer points to.