What are the pros for defining a function to be constexpr
. For example the gcd
function
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
can be written using constexpr
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
Is there any improvement in time it takes to run or execute the program or any other benefits?