File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change 6
6
#include < list>
7
7
#include < map>
8
8
#include < vector>
9
+ #include < algorithm>
9
10
#include < string.h>
10
11
#include < math.h>
11
12
@@ -227,27 +228,17 @@ class scratch_area
227
228
m_column_name_pos.push_back ( std::pair<const char *, int >(n, pos));
228
229
}
229
230
230
- void update (std::vector<char *>& tokens, size_t num_of_tokens)
231
+ void update (const std::vector<char *>& tokens, size_t num_of_tokens)
231
232
{
232
- size_t i=0 ;
233
- for (auto s : tokens)
234
- {
235
- if (i>=num_of_tokens)
236
- {
237
- break ;
238
- }
239
-
240
- m_columns[i++] = s;
241
- }
242
- m_upper_bound = i;
243
-
233
+ std::copy_n (tokens.begin (), num_of_tokens, m_columns.begin ());
234
+ m_upper_bound = num_of_tokens;
244
235
}
245
236
246
237
int get_column_pos (const char * n)
247
238
{
248
239
// done only upon building the AST, not on "runtime"
249
240
250
- for ( auto iter : m_column_name_pos)
241
+ for ( const auto & iter : m_column_name_pos)
251
242
{
252
243
if (!strcmp (iter.first .c_str (), n))
253
244
{
You can’t perform that action at this time.
0 commit comments