We have a class with something that, simplified, looks like this:
template <typename Tclass foo
{
T beyondAllReachi ng;
// In VC2005, this works OK
template <typename Ufriend void method(foo<Tl, foo<Ur);
// But VC2008 requires this
template <typename U, class Vfriend void method(U l, V r);
};
// To allow the actual function to access the private data.
template <typename T, typename Uvoid method(foo<Tl, foo<Ur)
{
l.beyondAllReac hing = r.beyondAllReac hing;
}
It occurs to me writing this that method<int, charis not a friend of
foo<char- so I'm a bit surprised that either works. But that isn't
the main point. I want to know:
- Which is the correct syntax?
- Is there a way to stop a method<string, stringaccessing the privates
of a foo<char>?
Thanks
Andy
template <typename Tclass foo
{
T beyondAllReachi ng;
// In VC2005, this works OK
template <typename Ufriend void method(foo<Tl, foo<Ur);
// But VC2008 requires this
template <typename U, class Vfriend void method(U l, V r);
};
// To allow the actual function to access the private data.
template <typename T, typename Uvoid method(foo<Tl, foo<Ur)
{
l.beyondAllReac hing = r.beyondAllReac hing;
}
It occurs to me writing this that method<int, charis not a friend of
foo<char- so I'm a bit surprised that either works. But that isn't
the main point. I want to know:
- Which is the correct syntax?
- Is there a way to stop a method<string, stringaccessing the privates
of a foo<char>?
Thanks
Andy
Comment