Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // .cpp
- template<typename T>
- Hospital<T>::Hospital () {
- #ifdef MY_DEBUG
- clog << D_PREFIX "Hospital constructor called!" << endl;
- #endif
- h = new Hospital::HospitalPrivate();
- }
- template<typename T>
- void Hospital<T>::sortPatients (T Sort) {
- int i;
- i = h->patient.size();
- if (i < 2) {
- return;
- } else {
- for (int k = 0; k < i-1; k++) {
- for (int j = 0; j < i - 2; j++) {
- if ( Sort(*h->patient[j], *h->patient[j+1] )) {
- swap(h->patient.at(j), h->patient.at(j+1));
- }
- }
- }
- }
- }
- // main.cpp
- Hospital<CompareFunc<Patient>> hospital;
- hospital.sortPatients(CompareFunc<Patient>());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement