@@ -252,7 +252,7 @@ namespace chaiscript
252
252
{
253
253
}
254
254
255
- virtual bool operator ==(const dispatch::Proxy_Function_Base &rhs) const
255
+ virtual bool operator ==(const dispatch::Proxy_Function_Base &rhs) const override
256
256
{
257
257
try {
258
258
const Dispatch_Function &dispatchfun = dynamic_cast <const Dispatch_Function &>(rhs);
@@ -264,17 +264,17 @@ namespace chaiscript
264
264
265
265
virtual ~Dispatch_Function () {}
266
266
267
- virtual std::vector<Const_Proxy_Function> get_contained_functions () const
267
+ virtual std::vector<Const_Proxy_Function> get_contained_functions () const override
268
268
{
269
269
return std::vector<Const_Proxy_Function>(m_funcs.begin (), m_funcs.end ());
270
270
}
271
271
272
272
273
- virtual int get_arity () const
273
+ virtual int get_arity () const override
274
274
{
275
275
typedef std::vector<Proxy_Function> function_vec;
276
276
277
- function_vec::const_iterator begin = m_funcs.begin ();
277
+ auto begin = m_funcs.begin ();
278
278
const function_vec::const_iterator end = m_funcs.end ();
279
279
280
280
if (begin != end)
@@ -300,12 +300,10 @@ namespace chaiscript
300
300
return -1 ; // unknown arity
301
301
}
302
302
303
- virtual bool call_match (const std::vector<Boxed_Value> &vals, const Dynamic_Cast_Conversions &t_conversions) const
303
+ virtual bool call_match (const std::vector<Boxed_Value> &vals, const Dynamic_Cast_Conversions &t_conversions) const override
304
304
{
305
- typedef std::vector<Proxy_Function> function_vec;
306
-
307
- function_vec::const_iterator begin = m_funcs.begin ();
308
- function_vec::const_iterator end = m_funcs.end ();
305
+ auto begin = m_funcs.begin ();
306
+ auto end = m_funcs.end ();
309
307
310
308
while (begin != end)
311
309
{
@@ -320,13 +318,13 @@ namespace chaiscript
320
318
return false ;
321
319
}
322
320
323
- virtual std::string annotation () const
321
+ virtual std::string annotation () const override
324
322
{
325
323
return " Multiple method dispatch function wrapper." ;
326
324
}
327
325
328
326
protected:
329
- virtual Boxed_Value do_call (const std::vector<Boxed_Value> ¶ms, const Dynamic_Cast_Conversions &t_conversions) const
327
+ virtual Boxed_Value do_call (const std::vector<Boxed_Value> ¶ms, const Dynamic_Cast_Conversions &t_conversions) const override
330
328
{
331
329
return dispatch::dispatch (m_funcs.begin (), m_funcs.end (), params, t_conversions);
332
330
}
@@ -338,7 +336,7 @@ namespace chaiscript
338
336
{
339
337
typedef std::vector<Proxy_Function> function_vec;
340
338
341
- function_vec::const_iterator begin = t_funcs.begin ();
339
+ auto begin = t_funcs.begin ();
342
340
const function_vec::const_iterator end = t_funcs.end ();
343
341
344
342
if (begin != end)
@@ -477,7 +475,7 @@ namespace chaiscript
477
475
validate_object_name (name);
478
476
479
477
Scope &scope = stack.back ();
480
- Scope::iterator itr = scope.find (name);
478
+ auto itr = scope.find (name);
481
479
if (itr != stack.back ().end ())
482
480
{
483
481
throw chaiscript::exception::name_conflict_error (name);
@@ -598,7 +596,7 @@ namespace chaiscript
598
596
{
599
597
chaiscript::detail::threading::shared_lock<chaiscript::detail::threading::shared_mutex> l (m_global_object_mutex);
600
598
601
- std::map<std::string, Boxed_Value>::const_iterator itr = m_state.m_global_objects .find (name);
599
+ auto itr = m_state.m_global_objects .find (name);
602
600
if (itr != m_state.m_global_objects .end ())
603
601
{
604
602
return itr->second ;
@@ -628,7 +626,7 @@ namespace chaiscript
628
626
{
629
627
chaiscript::detail::threading::shared_lock<chaiscript::detail::threading::shared_mutex> l (m_mutex);
630
628
631
- Type_Name_Map::const_iterator itr = m_state.m_types .find (name);
629
+ auto itr = m_state.m_types .find (name);
632
630
633
631
if (itr != m_state.m_types .end ())
634
632
{
@@ -647,13 +645,11 @@ namespace chaiscript
647
645
{
648
646
chaiscript::detail::threading::shared_lock<chaiscript::detail::threading::shared_mutex> l (m_mutex);
649
647
650
- for (Type_Name_Map::const_iterator itr = m_state.m_types .begin ();
651
- itr != m_state.m_types .end ();
652
- ++itr)
648
+ for (const auto & elem : m_state.m_types )
653
649
{
654
- if (itr-> second .bare_equal (ti))
650
+ if (elem. second .bare_equal (ti))
655
651
{
656
- return itr-> first ;
652
+ return elem. first ;
657
653
}
658
654
}
659
655
@@ -680,7 +676,7 @@ namespace chaiscript
680
676
681
677
const std::map<std::string, std::vector<Proxy_Function> > &funs = get_functions_int ();
682
678
683
- std::map<std::string, std::vector<Proxy_Function> >::const_iterator itr
679
+ auto itr
684
680
= funs.find (t_name);
685
681
686
682
if (itr != funs.end ())
@@ -699,7 +695,7 @@ namespace chaiscript
699
695
700
696
const std::map<std::string, Proxy_Function> &funs = get_function_objects_int ();
701
697
702
- std::map<std::string, Proxy_Function>::const_iterator itr = funs.find (t_name);
698
+ auto itr = funs.find (t_name);
703
699
704
700
if (itr != funs.end ())
705
701
{
@@ -756,7 +752,7 @@ namespace chaiscript
756
752
757
753
// note: map insert doesn't overwrite existing values, which is why this works
758
754
759
- for (StackData::reverse_iterator itr = stack.rbegin (); itr != stack.rend (); ++itr)
755
+ for (auto itr = stack.rbegin (); itr != stack.rend (); ++itr)
760
756
{
761
757
retval.insert (itr->begin (), itr->end ());
762
758
}
@@ -783,11 +779,9 @@ namespace chaiscript
783
779
784
780
std::map<std::string, Boxed_Value> objs;
785
781
786
- for (std::map<std::string, Proxy_Function>::const_iterator itr = funs.begin ();
787
- itr != funs.end ();
788
- ++itr)
782
+ for (const auto & fun : funs)
789
783
{
790
- objs.insert (std::make_pair (itr-> first , const_var (itr-> second )));
784
+ objs.insert (std::make_pair (fun. first , const_var (fun. second )));
791
785
}
792
786
793
787
return objs;
@@ -805,15 +799,11 @@ namespace chaiscript
805
799
806
800
const std::map<std::string, std::vector<Proxy_Function> > &functions = get_functions_int ();
807
801
808
- for (std::map<std::string, std::vector<Proxy_Function> >::const_iterator itr = functions.begin ();
809
- itr != functions.end ();
810
- ++itr)
802
+ for (const auto & function : functions)
811
803
{
812
- for (std::vector<Proxy_Function>::const_iterator itr2 = itr->second .begin ();
813
- itr2 != itr->second .end ();
814
- ++itr2)
804
+ for (const auto & internal_func : function.second )
815
805
{
816
- rets.push_back (std::make_pair (itr-> first , *itr2 ));
806
+ rets.push_back (std::make_pair (function. first , internal_func ));
817
807
}
818
808
}
819
809
@@ -1171,7 +1161,7 @@ namespace chaiscript
1171
1161
1172
1162
std::map<std::string, std::vector<Proxy_Function> > &funcs = get_functions_int ();
1173
1163
1174
- std::map<std::string, std::vector<Proxy_Function> >::iterator itr
1164
+ auto itr
1175
1165
= funcs.find (t_name);
1176
1166
1177
1167
std::map<std::string, Proxy_Function> &func_objs = get_function_objects_int ();
1 commit comments
lefticus commentedon May 10, 2014
@jonathandturner @axelstudios
The results from clang-modernize. Note that I had to build it from scratch to get it to work, which wasn't terribly painful. The cmake llvm build system seems to be working fine. You just have to clone llvm, then llvm/tools, then llvm/tools/clang/tools.