Example #1
0
void RuntimeVariablesContainer::Merge(const gd::VariablesContainer& container) {
  for (std::size_t i = 0; i < container.Count(); ++i) {
    const gd::String& name = container.GetNameAt(i);
    const gd::Variable& variable = container.Get(i);

    if (Has(name))
      Get(name) = variable;
    else {
      gd::Variable* newVariable = new gd::Variable(variable);
      variablesArray.push_back(newVariable);
      variables[name] = newVariable;
    }
  }
}
void RuntimeVariablesContainer::Merge(const gd::VariablesContainer & container)
{
    for ( unsigned int i = 0; i<container.Count();++i)
    {
        const std::pair<std::string, gd::Variable> & variable = container.Get(i);

        if ( Has(variable.first) )
            Get(variable.first) = variable.second;
        else
        {
            gd::Variable * newVariable = new gd::Variable(variable.second);
            variablesArray.push_back(newVariable);
            variables[variable.first] = newVariable;
        }
    }
}