开发者

record duplication in c++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

Can anyone tell me how to delete duplicate records or avoid 开发者_运维知识库duplication in the first place?

The problem is that whenever I edit a record, a duplicate record is created.

Can anyone please send an answer??


Try to use std::map or std::set collections. They don't store duplicates. Some containers have methods like unique() or you can just use unique() or unique_if() algorithms. By the way where do you duplicate records? Is it a problem with ado(.net) usage or maybe with some specific collection you use? Where do you see duplicated records? In memory, in db or maybe in some file?

Alek


The general approach to avoiding duplicates, regardless of language, is to use a hashtable to store your records. This assumes there is a field which serves as a unique identifier. Doctor Dobb's Journal as an article on C++ and hashing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜