Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ex13.31 answer, swap haven't been called #395

Open
sunlianqiang opened this issue Feb 24, 2016 · 2 comments
Open

ex13.31 answer, swap haven't been called #395

sunlianqiang opened this issue Feb 24, 2016 · 2 comments

Comments

@sunlianqiang
Copy link

ex13.31 answer, swap haven't been called.
sort called operator < which has been override, but didn't call the swap function.
image
@pezy @Mooophy

@pezy
Copy link
Collaborator

pezy commented Feb 24, 2016

please show your own code.

@MRamez
Copy link

MRamez commented Mar 3, 2016

Hi,
Insertion sort is faster than quick sort for small inputs. I think here gcc uses insertion sort instead of quick sort, which requires no swapping. Give your vector more elements (more than 20) and check if swap is called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants