Answer the question
In order to leave comments, you need to log in
Is there an analogue in PHP of the std::pair function?
for (const std::pair<uint32_t, Parameter>& p : m.parameters)
{
QString start = QString::fromUtf8(p.second.start.c_str());
m_parameters[p.first] = value;
m_parametersVisibility[p.first] = true;
}
Answer the question
In order to leave comments, you need to log in
something like this, correct minor errors yourself
//for (const std::pair<uint32_t, Parameter>& p : m.parameters)
foreach ($m->parameters as $k => $v) {
//QString start = QString::fromUtf8(p.second.start.c_str());
$start = $v->start;
// m_parameters[p.first] = value;
$this->m_parameters[$k] = $value;
// m_parametersVisibility[p.first] = true;
$this->m_parametersVisibility[$k] = True;
}
Pair is not a function, but a pair (double tuple).
The for(v:a) construct iterates over the elements of the container. m.parameters can be a list, vector, array of pairs. But most likely it is an associative array. In a pair, the first element is the key, the second is the value.
I don’t know about php, but Google says about each.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question