From f64cbe1e81b14e4203a17a1c3328e212ea95e8c0 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 2 Nov 2015 08:13:32 -0500 Subject: [PATCH] Column: A std::map was being used as a std::set --- src/columns/Column.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/columns/Column.cpp b/src/columns/Column.cpp index cce46778c..261bf8f57 100644 --- a/src/columns/Column.cpp +++ b/src/columns/Column.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -148,24 +149,25 @@ void Column::factory (std::map & all) void Column::uda (std::map & all) { // For each UDA, instantiate and initialize ColumnUDA(). - std::map udas; + std::set udas; for (auto& i : context.config) { if (i.first.substr (0, 4) == "uda.") { - std::string::size_type period = 4; + std::string::size_type period = 4; // One byte after the first '.'. + if ((period = i.first.find ('.', period)) != std::string::npos) - udas[i.first.substr (4, period - 4)] = 0; + udas.insert (i.first.substr (4, period - 4)); } } for (auto& uda : udas) { - if (all.find (uda.first) != all.end ()) - throw format (STRING_UDA_COLLISION, uda.first); + if (all.find (uda) != all.end ()) + throw format (STRING_UDA_COLLISION, uda); - Column* c = Column::uda (uda.first); + Column* c = Column::uda (uda); all[c->_name] = c; } }