template function not matching

Here is a source code I am trying to compile:
http://www.copypastecode.com/71129/

I get following errors:

zad9.cpp:93:39: error: no matching function for call to ‘sumuj(std::vector<Point<int> >::iterator, std::vector<Point<int> >::iterator)’
zad9.cpp:95:41: error: no matching function for call to ‘sumuj(std::vector<Point<int> >::iterator, std::vector<Point<int> >::iterator)’
zad9.cpp:102:55: error: no matching function for call to ‘sumuj(std::vector<Point<float> >::iterator, std::vector<Point<float> >::iterator)’

For me these functions fit perfectly to calling syntax :(
Calling sumuj(1,2) generates errors but matches template function!

Do you have any idea why (1,2) matches but std::vector<Point<int> >::iterator, std::vector<Point<int> >::iterator) don't ?
If you have any suggestions not connected with error how to improve my code it will be very appreciated.

P.S. This is excercise on abstract programming classes(traits and policy in c++).
It is good to have more than one compiler - the error message you would get from MSVC
is slightly more helpful -
"Failed to specialize function template'Point<iterator_traits<_Iter>::value_type>::Result sumuj(T,T)'"

Lets step through it:
The type of object you are trying to return is
Point<iterator_traits<_Iter>::value_type>::Result

which is basically type of :
Point ::Result

and if you look at the code you posted you will see that class Point does NOT contain a
subtype called Result
- so function sumuj cannot be instantiated by the compiler because the return type is INVALID.

Yet this is very strange because when I fix this error I still get no matching function error :/
I am using Ubuntu and this is impossible for me to verify on MSVC, llvm also reports no matching function.

Any other idea why gcc might not interpret this correctly?


EDIT:
Yay you were right I forgot to fix this error also in another line ;p
clang++ was very helpul he pointed this error in an instant.
Last edited on
Topic archived. No new replies allowed.