Hi,

I wonder what the way is to remove dublettes from a List. ?
I have filled a List like this:

List<String^>^ List1 = gcnew List<String^>();

List1->Add("123");
List1->Add("124");
List1->Add("123");

Recommended Answers

All 6 Replies

You must be using old version of visual studio. The current version does not use pointers, but the ^ operator

List<String^>^ List1 = gnew List<String^>;
// etc

Upgrade to either 2008 or 2010 so that you can use newest version of C++/CLR language.

As for your question, probably do it like you would anything else. Iterate through the list to find duplicates and delete them when found. You would need two loops for that.

Okay, I will check it out.
I understand how I can do it with 2 loops. I was just hoping for if there was any type of function for this etc.

Thanks for help!

You must be using old version of visual studio. The current version does not use pointers, but the ^ operator

List<String^>^ List1 = gnew List<String^>;
// etc

Upgrade to either 2008 or 2010 so that you can use newest version of C++/CLR language.

As for your question, probably do it like you would anything else. Iterate through the list to find duplicates and delete them when found. You would need two loops for that.

That is the std:: namespace and I doing the code in managed. Thanks.

How about std::set?

That is the std:: namespace and I doing the code in managed. Thanks.

and what is the problem?

I got help from AD to solve it with 2 loops.

and what is the problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.