Doing Managed C++ in VS2008. Have a vendor defined data structure as follows:
class API TF_StringList
{
public:
TF_StringList(const char* encoding = "cp_1252");
~TF_StringList();
TF_String* first_string() const {return start_string;}
TF_String* last_string() const {return end_string;}
void insert(const TF_String& aString);
void insert(const char* aString);
// If the length parameter is larger than the size of the string,
// The behavior is uncertain.
void insert(const tf_Byte* aString, size_t aByteLength);
void clear();
size_t size() const { return list_size; }
char* character_encoding;
private:
void set_first(TF_String* stringPtr) {start_string = stringPtr;}
void set_last (TF_String* stringPtr) {end_string = stringPtr;}
TF_String* start_string;
TF_String* end_string;
TF_String* curr_pos;
size_t list_size;
// Do not expose the copy constructor and the assignment operator.
TF_StringList(const TF_StringList& tmp);
TF_StringList& operator=(const TF_StringList& tmp);
};
In one of my managed functions I have parameter of List<String^> categoryList
and I want to load an object of type TF_StringList with the elements of that parameter.
//Instantiate the TF_StringList
categories = new TF_StringList();
for(int i=0; i<categoryList.Count; i++)
{
const char* str = (char*)(Marshal::StringToHGlobalAnsi(categoryList[i])).ToPointer();
categories->insert(str);
}
The error I get is: error C2663: 'TF_StringList::insert' : 3 overloads have no legal conversion for 'this' pointer
What have I done wrong? Jim