Permalink
Browse files

STL Set already does duplicate checking.

  • Loading branch information...
mhroth committed Mar 25, 2012
1 parent 9d90f7d commit 15f9de4e4e55e0a7b94318ae50d22abb3f3bea3b
Showing with 3 additions and 7 deletions.
  1. +3 −7 src/MessageSendController.cpp
@@ -114,14 +114,10 @@ void MessageSendController::removeReceiver(RemoteMessageReceiver *receiver) {
}
void MessageSendController::registerExternalReceiver(const char *receiverName) {
- string str = string(receiverName);
- // check to make sure that the same receiver name is not entered more than once
- if (externalReceiverSet.find(str) == externalReceiverSet.end()) {
- externalReceiverSet.insert(str);
- }
+ // sets only contain unique items
+ externalReceiverSet.insert(string(receiverName));
}
void MessageSendController::unregisterExternalReceiver(const char *receiverName) {
- string str = string(receiverName);
- externalReceiverSet.erase(str);
+ externalReceiverSet.erase(string(receiverName));
}

0 comments on commit 15f9de4

Please sign in to comment.