diff --git a/include/s3select_oper.h b/include/s3select_oper.h index 41a5021d..d7fe49dc 100644 --- a/include/s3select_oper.h +++ b/include/s3select_oper.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -227,27 +228,17 @@ class scratch_area m_column_name_pos.push_back( std::pair(n, pos)); } - void update(std::vector& tokens, size_t num_of_tokens) + void update(const std::vector& tokens, size_t num_of_tokens) { - size_t i=0; - for(auto s : tokens) - { - if (i>=num_of_tokens) - { - break; - } - - m_columns[i++] = s; - } - m_upper_bound = i; - + std::copy_n(tokens.begin(), num_of_tokens, m_columns.begin()); + m_upper_bound = num_of_tokens; } int get_column_pos(const char* n) { //done only upon building the AST, not on "runtime" - for( auto iter : m_column_name_pos) + for (const auto& iter : m_column_name_pos) { if (!strcmp(iter.first.c_str(), n)) {