Given this:
typedef MyClass<int> IntClass;typedef MyClass<float> FloatClass;
First example generates this code:
class IntClass{public: void someNormalMemberFunction(int a); friend int myFriend(IntClass a);}class FloatClass{public: void someNormalMemberFunction(floata); friend float myFriend(FloatClass a);}
You cannot assign one to another, and neither can access the other's private members.
For second case, the folowing code gets generated:
class IntClass{public: void someNormalMemberFunction(int a); friend int myFriend(IntClass a); friend float myFriend(FloatClass a);}class FloatClass{public: void someNormalMemberFunction(float a); friend int myFriend(IntClass a); friend float myFriend(FloatClass a);}
Both have access to each other's private members, and they can be cross-assigned.
This is same as rebind<> concept in STL allocators, which allow assignment between containers with different allocators.