The Issue:
Class declaration is as below:
class Select {
public:
template<typename Iterator>
static Iterator function(Iterator , Iterator , bool (*judgeFunction)(Iterator A, Iterator B) = priFunction);
private:
template<typename Iterator>
inline static bool priFunction(Iterator , Iterator);
And my test file is as below:
template <typename T>
void showFunction(std::vector<T> &A){
Select S;
std::cout<<*S.function(A.begin(),A.end())<<std::endl;
}
CLion remarked an error for the test file:
In template: 'priFunction' is a private member of 'Select'
I used the following sentence compiled my CppFile:
g++ -o ExeFile CppFile.cpp -I "../../../Include/"
And its ExeFile ran successfully.
My Question
- Can the member function in private or protected scope of a class be declared as a default parameter in the class' public functions' parameter list?
- If there's no error in fact,How could I hide the error reminder of CLion?(unecessary)
My Clion version is 2022.1.3.