If I store a tuple in a class as such:
class BaseA { } //So that I can store A in a class
template <typename Args...>
class A : public BaseA {
public:
//I'm omitting the constructors
private:
std::tuple<Args...> storedTup;
}
Would you be able to retrieve the values later on by doing something along the lines of this?
//Change BaseA
class BaseA {
public:
virtual ~BaseA(){}
auto returnTuple();
}
//Change A
template <typename Args...>
class A : public BaseA {
public:
auto returnTuple() -> decltype(storedTup) {
return storedTup;
}
private:
std::tuple<Args...> storedTup;
}
I understand that this doesn't work but is there an easy fix that I am overlooking. From what I have seen, decltype can use members passed through the function (In my case returnTuple) but since my tuple is already stored that won't really help. Would there be another way to make the auto return type that of the tuple?