I want to use a simple struct with member variables named start and end in a function template:
#include <iostream>
using namespace std;
struct st {
    int start;
    int end;
};
template<typename T>
void compare(const T& v1, const T& v2){
    if(v1.end < v2.end)
        cout << "v1 < v2" << endl;
}
int main() {
    st a = {1, 2};
    st b = {2, 3};
    compare(a, b);
    return 0;
}
But this program fails to compile on mingw g++ 4.8.2 with:
main.cpp: In function 'void compare(const T&, const T&)':
main.cpp:11:11: error: parse error in template argument list
     if(v1.end < v2.end)
           ^
main.cpp: In instantiation of 'void compare(const T&, const T&) [with T = st]':
main.cpp:18:17:   required from here
main.cpp:11:5: error: 'end' is not a member template function
     if(v1.end < v2.end)
     ^
Why not? What's wrong with my code?
 
     
     
     
     
    