#include <iostream>
#include<map>
#include<string>
#include<vector>
#include<functional>
struct string_size_less
{
bool operator()(const std::string &a, const std::string &b) const
{
return a.size() < b.size();
}
};
template <typename T, typename Compare = std::less<T>>
void fooFunction2(T arr[], int beginElem, int endElem, int arraySize, Compare comp = Compare{})
{
}
template <typename T, typename Compare = std::less<T>>
void fooFunction(T arr[], int arraySize, Compare comp = Compare{})
{
int endElem=arraySize-1;
int beginElem =0;
fooFunction2(arr, beginElem , endElem, arraySize, comp); //I am getting the errors here
}
int main()
{
int arrI[] = { 4, 5, 1, 4, 2};
std::string arrS[] = {"Car", "Bicycle", "Metro", "Bike"};
fooFunction(arrI, 5);
fooFunction(arrS, 4, string_size_less());
return 0;
}