Hi, @Markus Freitag
Eg.
data
std::map<std::string, Component> m_DicProcessdata = {
{"TableMotorPosY", {"TableMotorPosY", "80", "mm", false}},
{"TableMotorPosA", {"TableMotorPosA", "90", "mm", true}},
{"TableMotorPosB", {"TableMotorPosB", "50", "mm", true}},
{"TableMotorPosC", {"TableMotorPosC", "150", "mm", true}},
{"EnvironmentalTemperature", {"EnvironmentalTemperature", "50", "°C", false}}
};
ProcessKeys whose value is >80
use std::stoi
const int value = 80;
for (const auto& it : m_DicProcessdata) {
if (std::stoi(it.second.Value) > value) {
std::cout << "ProcessKey: " << it.first << ", Value: " << it.second.Value << std::endl;
}
}
std::map::find()
const std::string substringToFind = "TableMotorPos";
for (const auto& it : m_DicProcessdata) {
if (it.first.find(substringToFind) != std::string::npos) {
std::cout << "ProcessKey: " << it.first << ", is: " << it.second.Value << std::endl;
}
}
The value should be able to update using operator [].
Best regards,
Minxin Yu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.