There are a ton of questions regarding this problem but none of them seem to be a solution to my problem. I don't think this is really a Boost::Variant issue; I'm pretty sure that I'm just using templates in an incorrect manner. I was able to strip down the code so you can compile it and see the problem for yourself, it's pretty simple - I keep getting a 'no function call' error from gcc even though it appears to be right there. I'm probably doing something stupid but I can't seem to see what I'm doing wrong.
#include <boost/variant.hpp>
typedef boost::variant<int, std::string> Data;
struct A
{
template <typename T> T data() { return boost::get<T>(m_data); };
private:
Data m_data;
};
struct B
{
template <typename T> T data() { return m_a.data(); };
private:
A m_a;
};
int main (int argc, char *argv[])
{
return 0;
};
m_a.data<T>();
?B::data
function somewhere. For example inmain
add a variable ofB
and calldata
on it...