3 ms·
From what I could see through hundreds of godbolt snippets, if you declare the variable you'll return at the very top of the function before any control flow, N
by jcelerier 5y ago
From what I could see through hundreds of godbolt snippets, if you declare the variable you'll return at the very top of the function before any control flow, NRVO will pretty much always happen.