mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-22 22:16:37 +08:00
Update 1.1.0.md
This commit is contained in:
parent
be084689fe
commit
5b512f3cbc
@ -61,11 +61,13 @@ Example:
|
||||
```cpp
|
||||
oatpp::Vector<oatpp::String> vector = oatpp::Vector<oatpp::String>::createShared();
|
||||
oatpp::List<oatpp::String> list = oatpp::List<oatpp::String>::createShared();
|
||||
oatpp::UnorderedSet<oatpp::String> set = oatpp::UnorderedSet<oatpp::String>::createShared();
|
||||
oatpp::Fields<oatpp::String> pairList= oatpp::Fields<oatpp::String>::createShared();
|
||||
oatpp::UnorderedFields<oatpp::String> hashMap = oatpp::UnorderedFields<oatpp::String>::createShared();
|
||||
|
||||
oatpp::Vector<oatpp::String> vector = {"a", "b", "c"};
|
||||
oatpp::List<oatpp::String> list = {"a", "b", "c"};
|
||||
oatpp::UnorderedSet<oatpp::String> set = {"a", "b", "c"};
|
||||
oatpp::Fields<oatpp::String> pairList = {{"k1", "v1"}, {"k2", "v2"}, {"k3", "v3"}};
|
||||
oatpp::UnorderedFields<oatpp::String> hashMap = {{"k1", "v1"}, {"k2", "v2"}, {"k3", "v3"}};
|
||||
|
||||
@ -75,6 +77,9 @@ vector->push_back("www");
|
||||
list[0] = "z"; // <--- Complexity = O(n);
|
||||
list->push_back("www");
|
||||
|
||||
bool contains = set["b"]; // <--- Complexity = O(1);
|
||||
set->insert("z")
|
||||
|
||||
pairList["k1"] = "z"; // <--- Complexity = O(n);
|
||||
pairList->push_back({"key_z", "z"});
|
||||
|
||||
@ -89,6 +94,10 @@ for(auto& item : *list) {
|
||||
...
|
||||
}
|
||||
|
||||
for(auto& item : *set) {
|
||||
...
|
||||
}
|
||||
|
||||
for(auto& pair : *pairList) {
|
||||
...
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user