Re[3]: Function object as const&
От: Vamp Россия  
Дата: 10.11.10 16:12
Оценка:
MS>G++ v4.2.1 не хочет есть. http://dinkumware.com/exam/ — с "const Less&" — не ест, с просто "Less&" — нормально.


#include <iostream>
#include <vector>
using namespace std;

template<class Array, class Less> 
void Sort(Array& arr, const Less& less) {}
 
struct SortType {
   int Key;
};

bool Cmp(const SortType& a, const SortType& b)
{
    return a.Key < b.Key;
}

int main()
    {
 vector<int> array;
 Sort(array, Cmp);

    }


Комо жрет.
Да здравствует мыло душистое и веревка пушистая.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.