I have a class which uses return code:
class MyClass
{
// ...
public:
// ValueType get_value() const; // usual code
ErrorCode get_value(ValueType& value) const; // uses error code
// ...
};
Thus, the second form of get_value()
actually provides the value as function parameter, rather than as return value.
Is it possible to deduce the type of the function parameter of get_value()
, maybe using decltype
?
int main()
{
// ...
MyClass my_class;
// auto val = my_class.get_value(); // okay: value has correct type
declytype( /* something here */ ) value;
const auto error = my_class.get_value( value );
// ...
}