jeudi 23 juin 2016

How to detect if a func. is a constexpr? and mark other func. constexpr depending on it?

Assuming i have some function template f1:

template<typename f2>
int f1(int i, int j) throw() {
  return i + j + f2(i, j);
}

is there way to determine if 'f2(i, j)' can be a constexpr. (no matter it is a func. or a functor) and so mark 'f1' as a constexpr. too?

I am thinking of using SFINAE here some how, but didn't find how to detect constexpr. using type traits

Aucun commentaire:

Enregistrer un commentaire