hi *

I have a question, why I can't declare template parameter as a friend?
Here is some example:

//--------------------------------------------------
template <typename T>
class Some
{
    friend class T;

public:

    Some() {}

private:

    T* a;
};

template <typename T>
class Other
{
public:

    Other() {}

private:

    T a;

};


int main()
{
    Some<Other<int> > s;

    return 0;
}
//--------------------------------------------------

When I try to compile it using g++ 3.4.6 I got such an error: "using
typedef-name T after class"
When I change class to typename I get such error: "expected nested-
name-specifier before T", "ISO C++ forbids declaration of `T' with no
type", "`T' is neither function nor member function; cannot be
declared friend"

thanks in advance

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to