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

Update bubble_sort.h #153

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update bubble_sort.h #153

wants to merge 1 commit into from

Conversation

Pranay711
Copy link

Bubble sort using template and funtion in c++. @pierredavidbelanger @Samana @blackball @wycg1984

@pierredavidbelanger
Copy link
Contributor

Since I am tagged, I will say something.

I am not sure its a good idea to include bits/stdc++, I was told a couple of time that this is not a good practice.
And anyways, using clang++ (the default for this project), it does not compile out of the box:

$ make bubble_sort_demo 
clang++ -g -Wall -Wno-unused-function -o bubble_sort_demo src/bubble_sort_demo.cpp -I./include -I. -lm
In file included from src/bubble_sort_demo.cpp:6:
./include/bubble_sort.h:26:10: fatal error: 'bits/stdc++' file not found
#include <bits/stdc++>
         ^~~~~~~~~~~~~
1 error generated.
make: *** [Makefile:245: bubble_sort_demo] Error 1

Also, src/bubble_sort_demo.cpp will expect the right namespace and function signature here

Do you care to explain what you are trying to achieve ?

Have a nice day :)

@pierredavidbelanger
Copy link
Contributor

From my point of view, it is not an improvement to

  • break public contract (the signature changed from alg::BubbleSort(T[], int, int) to std::bubble(X*, int))
  • include unknown header so the project does not compile (fatal error: 'bits/stdc++' file not found).

I feel I am missing something here, I will leave let others review this PR.

@Pranay711
Copy link
Author

Pranay711 commented Oct 1, 2020 via email

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

Successfully merging this pull request may close these issues.

2 participants