what is the difference between returning decltype(auto) and returning only auto?

What is the difference between these 2 functions:

1
2
3
4
5
6
7
8
9
10
decltype(auto) doitDA(int a, char c, bool b)
{
        return (a + c + b);
}

auto doitA(int a, char c, bool b)
{
        return (a + c + b);
}


When should one use decltype(auto) vrs auto for deducing return types?

Regards,
Juan
Topic archived. No new replies allowed.