Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class T, class Pred>
- T ConditionalInput(LPSTR inputMessage, LPSTR errorMessage, Pred condition)
- {
- T input
- cout<< inputMessage;
- cin>> input;
- while(!condition(input))
- {
- cout<< errorMessage;
- cin>> input;
- }
- return input;
- }
- ...
- int row;
- row = ConditionalInput("Input the row of the number to lookup, row > 0: ", "[INPUT ERROR]: Specified number is not contained in the range [row > 0]. Please type again: ", [](int x){ return x > 0; });
- ...
- The error is:
- Error 1 error C2783: 'T ConditionalInput(LPSTR,LPSTR,predicate)' : could not deduce template argument for 'T' c_main.cpp 17 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement