simpler code

This commit is contained in:
qPCR4vir 2015-04-26 02:32:22 +02:00
parent 83fa73d11f
commit 585732a497

View File

@ -351,19 +351,23 @@ namespace nana
bool first{true}; bool first{true};
for( size_type idx{}; idx<exp_opt.columns_order.size(); ++idx) for( size_type idx{}; idx<exp_opt.columns_order.size(); ++idx)
{ {
size_type index{exp_opt.columns_order[idx]};
auto col = std::find_if(std::begin(cont()), std::end(cont()), [index](const column_t& col){return col.index == index;});
if(col == std::end(cont()) )
throw std::out_of_range("Trying to export from a lisboxt an inexisting column");
assert(col->visible || ! exp_opt.only_visible_columns);
if(first) if(first)
first=false; first=false;
else else
head_str += exp_opt.sep; head_str += exp_opt.sep;
head_str += col->text; size_type index{exp_opt.columns_order[idx]};
bool bad{true};
for (auto&col:cont())
if(col.index == index)
{
bad=false;
head_str += col.text;
break;
}
if(bad)
throw std::out_of_range("Trying to export from a lisboxt an inexisting column");
} }
return head_str; return head_str;
} }