File tree Expand file tree Collapse file tree 8 files changed +76
-0
lines changed Expand file tree Collapse file tree 8 files changed +76
-0
lines changed Original file line number Diff line number Diff line change @@ -1361,6 +1361,14 @@ namespace etl
1361
1361
}
1362
1362
#endif
1363
1363
1364
+ // *************************************************************************
1365
+ // / Check if the unordered_map contains the key.
1366
+ // *************************************************************************
1367
+ bool contains (const_key_reference key) const
1368
+ {
1369
+ return find (key) != end ();
1370
+ }
1371
+
1364
1372
protected:
1365
1373
1366
1374
// *********************************************************************
Original file line number Diff line number Diff line change @@ -1216,6 +1216,14 @@ namespace etl
1216
1216
}
1217
1217
#endif
1218
1218
1219
+ // *************************************************************************
1220
+ // / Check if the unordered_multimap contains the key.
1221
+ // *************************************************************************
1222
+ bool contains (const_key_reference key) const
1223
+ {
1224
+ return find (key) != end ();
1225
+ }
1226
+
1219
1227
protected:
1220
1228
1221
1229
// *********************************************************************
Original file line number Diff line number Diff line change @@ -1194,6 +1194,14 @@ namespace etl
1194
1194
}
1195
1195
#endif
1196
1196
1197
+ // *************************************************************************
1198
+ // / Check if the unordered_multiset contains the key.
1199
+ // *************************************************************************
1200
+ bool contains (key_parameter_t key) const
1201
+ {
1202
+ return find (key) != end ();
1203
+ }
1204
+
1197
1205
protected:
1198
1206
1199
1207
// *********************************************************************
Original file line number Diff line number Diff line change @@ -1214,6 +1214,14 @@ namespace etl
1214
1214
}
1215
1215
#endif
1216
1216
1217
+ // *************************************************************************
1218
+ // / Check if the unordered_set contains the key.
1219
+ // *************************************************************************
1220
+ bool contains (key_parameter_t key) const
1221
+ {
1222
+ return find (key) != end ();
1223
+ }
1224
+
1217
1225
protected:
1218
1226
1219
1227
// *********************************************************************
Original file line number Diff line number Diff line change @@ -1207,5 +1207,16 @@ namespace
1207
1207
CHECK_TRUE (map1 == map2a);
1208
1208
CHECK_FALSE (map1 == map2b);
1209
1209
}
1210
+
1211
+ // *************************************************************************
1212
+ TEST (test_contains)
1213
+ {
1214
+ DataNDC data (initial_data.begin (), initial_data.end ());
1215
+
1216
+ const char * not_inserted = " ZZ" ;
1217
+
1218
+ CHECK (data.contains (std::string (K0)));
1219
+ CHECK (!data.contains (std::string (not_inserted)));
1220
+ }
1210
1221
};
1211
1222
}
Original file line number Diff line number Diff line change @@ -1068,5 +1068,16 @@ namespace
1068
1068
CHECK_TRUE (map1 == map2a);
1069
1069
CHECK_FALSE (map1 == map2b);
1070
1070
}
1071
+
1072
+ // *************************************************************************
1073
+ TEST (test_contains)
1074
+ {
1075
+ DataNDC data (initial_data.begin (), initial_data.end ());
1076
+
1077
+ const char * not_inserted = " ZZ" ;
1078
+
1079
+ CHECK (data.contains (K0));
1080
+ CHECK (!data.contains (not_inserted));
1081
+ }
1071
1082
};
1072
1083
}
Original file line number Diff line number Diff line change @@ -943,5 +943,16 @@ namespace
943
943
CHECK_TRUE (set1 == set2a);
944
944
CHECK_FALSE (set1 == set2b);
945
945
}
946
+
947
+ // *************************************************************************
948
+ TEST (test_contains)
949
+ {
950
+ DataNDC data (initial_data.begin (), initial_data.end ());
951
+
952
+ NDC not_inserted = NDC (" ZZ" );
953
+
954
+ CHECK_TRUE (data.contains (N0));
955
+ CHECK_FALSE (data.contains (not_inserted));
956
+ }
946
957
};
947
958
}
Original file line number Diff line number Diff line change @@ -909,5 +909,16 @@ namespace
909
909
CHECK_TRUE (set1 == set2a);
910
910
CHECK_FALSE (set1 == set2b);
911
911
}
912
+
913
+ // *************************************************************************
914
+ TEST (test_contains)
915
+ {
916
+ DataNDC data (initial_data.begin (), initial_data.end ());
917
+
918
+ NDC not_inserted = NDC (" ZZ" );
919
+
920
+ CHECK_TRUE (data.contains (N0));
921
+ CHECK_FALSE (data.contains (not_inserted));
922
+ }
912
923
};
913
924
}
You can’t perform that action at this time.
0 commit comments