[C++] std::set/map

  • 2022.11.28
  • C++

Hash table in C++

初始化

  • std::set<template> s;
  • std::set<template> s{…};
  • template arr = {…};
    std::set<template> s(arr, arr + {length of arr});

  • std::map<template_key, template_value> m;
插入元素

s.insert(x);

m.insert({k, v});

刪除元素 a.erase(x);
查詢某元素/key是否存在 a.count(x); // 存在則回傳1, 不存在則回傳0

 

Last Updated on 2023/08/16 by A1go

Bitnami