Here is my code:
bool test(){
return true;
}
template<int asd[], bool T = test()>
void evenprocessor(){
std::cout<<"this is called"<<std::endl;
};
int asd[] = {1,2,3};
int main(int argc, char** argv) {
evenprocessor<asd>();
return 0;
}
So i like i was doing some testings for sfinae, i am curious if something like this is possible. Evaluating a function once the template is called. I get an error stating that no matching function to call to evenprocessor. Am i doing something wrong or it's impossible to evaluate a function if it's used inside a function or template parameter? like something like this:
template<int asd[]>
void evenprocessor(char(*)[test()]){
std::cout<<"this is called"<<std::endl;
};
int asd[] = {1,2,3};
int main(int argc, char** argv) {
evenprocessor<asd>();
return 0;
}
I get an error stating that it's variable or field evenprocessor declared void. Why is it declared void?
Aucun commentaire:
Enregistrer un commentaire