Skip to content

Commit

Permalink
Make sure all options with a given key are populated when we add a co…
Browse files Browse the repository at this point in the history
…nditional

option.
  • Loading branch information
abellgithub committed Jul 30, 2018
1 parent 9693732 commit 9135dae
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions pdal/Options.cpp
Expand Up @@ -99,10 +99,21 @@ void Options::addConditional(const Option& option)
}


void Options::addConditional(const Options& options)
void Options::addConditional(const Options& other)
{
for (auto& o : options.m_options)
addConditional(o.second);
for (auto oi = other.m_options.begin(); oi != other.m_options.end();)
{
const std::string& name = oi->first;
if (m_options.find(name) == m_options.end())
{
do
{
m_options.insert(*oi++);
} while (oi != other.m_options.end() && name == oi->first);
}
else
oi++;
}
}


Expand Down

0 comments on commit 9135dae

Please sign in to comment.