(N<M) ? commondivs<N,(M-N)>::val : commondivs<(N-M),M>::val
This line causes instantiation of both commondivs<N,(M-N)>::val
and commondivs<(N-M),M>::val
, even if the condition is known at compile time and one of the branches will never be taken.
Replace ? :
with std::conditional_t
, which doesn't have this limitation:
static const int val = std::conditional_t<N < M, commondivs<N,(M-N)>, commondivs<(N-M),M>>::val;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…