Init
This commit is contained in:
39
test_Hashmap.cpp
Normal file
39
test_Hashmap.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <Tourmaline/Containers/Hashmap.hpp>
|
||||
#include <Tourmaline/Systems/Logging.hpp>
|
||||
#include <string>
|
||||
|
||||
using namespace Tourmaline;
|
||||
int main() {
|
||||
Containers::Hashmap<std::string, std::size_t, 0.75f, 8> count;
|
||||
std::string input = "74 eb ff 5c f0 a9 4f 93 2e e1 1b 47 a4 13 3b 93 ";
|
||||
std::string buffer = "";
|
||||
for (char letter : input) {
|
||||
if (letter == ' ') {
|
||||
if (count.Has(buffer)) {
|
||||
count.Get(buffer)++;
|
||||
} else {
|
||||
count.Insert(buffer, 1);
|
||||
}
|
||||
buffer.clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
buffer += letter;
|
||||
}
|
||||
|
||||
for (char letter : input) {
|
||||
if (letter == ' ') {
|
||||
if (count.Has(buffer)) {
|
||||
Systems::Logging::Log(std::format("{} = {}", buffer, count.Get(buffer)),
|
||||
"Test");
|
||||
count.Remove(buffer);
|
||||
}
|
||||
buffer.clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
buffer += letter;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user