Sorry, but I can not find even the direction to solve the situation. The question is: There is a container class that is defined through a template.
template <typename T1, typename T2>
public ref class FormContainer
{ private: T1 ^ container; List <T2 ^> ^ elements; ... Int32 currentContainerItem (); public: property Int32 currentElementId { Int32 get { return currentContainerItem (); } } ... };
Different types of containers will be used for T1 (ComboBox, ListBox, DataGridView). I need to get the current item in the current container. I see no way other than to specialize the method for this action - currentContainerItem . The method will be valid for each type of container.
My implementation attempt (for ComboBox) turns out to be erroneous, but I can't understand why ...
template <typename T2>
inline Int32 FormContainer <ComboBox, T2> :: currentContainerIndex ()
{
return container-> SelestedIndex;
}
I do not want local gurus to write how to make the right decision. I ask you to direct my brain in the right direction and suggest the cause of the error.