A
Alexander Stippler
Hi,
I have a little problem to design some template classes in a realizable way.
I have some Container classes and some Proxy classes (proxies for
elements). Looks like this:
// P is the Proxy class.
template <typename T, typename P>
class Container
{
P
whatever() { return P(); }
};
template <typename T>
class Proxy1 { ... };
template <typename T>
class Proxy2 { ... };
For some reason every instance of class Proxy needs to know, which Container
class it is used for. Some behavior of Proxy is dependend on the specific
Container. So, when I call method whatever() I want to give the information
that I'm inside Container<T, P> to P. But I cannot give the Proxy class the
information via another template parameter, cause I would end up in an
endless recursive definition, since Container is parameterized by the
Proxy. Got my problem?
Best regards,
alex
I have a little problem to design some template classes in a realizable way.
I have some Container classes and some Proxy classes (proxies for
elements). Looks like this:
// P is the Proxy class.
template <typename T, typename P>
class Container
{
P
whatever() { return P(); }
};
template <typename T>
class Proxy1 { ... };
template <typename T>
class Proxy2 { ... };
For some reason every instance of class Proxy needs to know, which Container
class it is used for. Some behavior of Proxy is dependend on the specific
Container. So, when I call method whatever() I want to give the information
that I'm inside Container<T, P> to P. But I cannot give the Proxy class the
information via another template parameter, cause I would end up in an
endless recursive definition, since Container is parameterized by the
Proxy. Got my problem?
Best regards,
alex