This question was closed as a duplicate of What are some uses of decltype(auto)?, but actually there is no discussion in the referenced question at all about conversion operators, which are the primary topic of this question.
Starting from C++14 every class can have conversion methods operator auto and operator decltype(auto), e.g.:
#include <iostream>
struct S
{
operator auto() { return 1; }
operator decltype(auto) () { return 2.; }
};
int main()
{
S s;
std::cout << (int)s << '\n';
std::cout << (double)s << '\n';
}
https://gcc.godbolt.org/z/ExhrGPGvv
If we have two options operator auto and operator decltype(auto), is there any difference between them, and what option is better to choose on practice?