#can using auto break the return type

9 messages · Page 1 of 1 (latest)

silent lion
#
constexpr decltype(auto)
Reset(const typename Traits::Type& arg)
{ auto ret = Fun(); val_ = arg; return ret; }

I want this member function to return value of the same exact type that Fun returns

deft domeBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

silent lion
#

can auto ret break it?

#

like auto return type instead of decltype(auto) breaks

somber tangle
#

well as always it depends on what Fun returns

#

but decltype(auto) is the safer choice yeah

silent lion
#

oh, now I realised I can apply decltype(auto) for a variable as well as for a function

#

I thought it was only for functions

#

thanks