I have been working on a simple header only library, but I've run into a cyclic issue I can't figure. I'm returning by type which prob doesn't help matters.
template<typename T>
class Foo;
class Bar;
class Baz
{
public:
template<typename T>
T getAFoo<T>()
{
return Foo<T>();
}
Bar getABar() // Prefer return by type in this situation.
{
return Bar(); // Error.
}
};
template<typename T>
class Foo {
/* ... */
void doSomething() { m_baz.something(); }
Baz &m_baz;
};
class Bar {
/* ... */
void doSomething() { m_baz.something(); }
Baz &m_baz;
};
I tried to prototype the function Bar getABar()
then defining it after Bars
definition but that just spewed out duplicated symbol errors.
Kinda feel that I just need it to be a template with no value.