{"id":112,"date":"2007-07-27T01:36:58","date_gmt":"2007-07-27T00:36:58","guid":{"rendered":"http:\/\/people.iola.dk\/arj\/2007\/07\/27\/its-all-the-little-things\/"},"modified":"2007-10-24T23:27:17","modified_gmt":"2007-10-24T22:27:17","slug":"its-all-the-little-things","status":"publish","type":"post","link":"https:\/\/people.iola.dk\/arj\/2007\/07\/27\/its-all-the-little-things\/","title":{"rendered":"It&#8217;s all the little things"},"content":{"rendered":"<p>Having been coding in c# for some time now, what is really nice about the language compared to c++ is the foreach statement. The syntax is really natural and easy to read:<\/p>\n<pre class=\"prettyprint\">\r\n     foreach (string s in strings)\r\n<\/pre>\n<p>Compare this to the standard c++ notation:<\/p>\n<pre class=\"prettyprint\">\r\n     for (vector<string>::const_iterator i = strings.begin(),\r\n             iend = strings.end(); i != iend; ++i)\r\n<\/pre>\n<p>So I decided there must be something easier and vague remembered that boost had something for this. And low and behold they <a href=\"http:\/\/www.boost.org\/doc\/html\/foreach.html\">had<\/a>. So now instead of writing that horrible for line, one can just write:<\/p>\n<pre class=\"prettyprint\">\r\n     foreach (const string&amp; s, strings)\r\n<\/pre>\n<p>It&#8217;s not quite as nice as i c# since one can&#8217;t have a pair on the leftside of the comma, so one needs to be using typedefs to fix that. And one must also remember the &amp; as to not create unneeded copies of the string.<\/p>\n<p>And the best part is that it&#8217;s written as a bunch of templates and macro&#8217;s so one can just include a header and of it goes. Doesn&#8217;t even have to change the Makefile \ud83d\ude42<\/p>\n<p>I&#8217;ve converted the whole MMS 1.1.0 code base to the new syntax and it&#8217;s really so much easier to read. Especially because I tend to use better names for the loop variable than i \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Having been coding in c# for some time now, what is really nice about the language compared to c++ is the foreach statement. The syntax is really natural and easy to read: foreach (string s in strings) Compare this to the standard c++ notation: for (vector::const_iterator i = strings.begin(), iend = strings.end(); i != iend; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,19],"tags":[],"class_list":["post-112","post","type-post","status-publish","format-standard","hentry","category-my-media-system","category-programming"],"_links":{"self":[{"href":"https:\/\/people.iola.dk\/arj\/wp-json\/wp\/v2\/posts\/112","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/people.iola.dk\/arj\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/people.iola.dk\/arj\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/people.iola.dk\/arj\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/people.iola.dk\/arj\/wp-json\/wp\/v2\/comments?post=112"}],"version-history":[{"count":0,"href":"https:\/\/people.iola.dk\/arj\/wp-json\/wp\/v2\/posts\/112\/revisions"}],"wp:attachment":[{"href":"https:\/\/people.iola.dk\/arj\/wp-json\/wp\/v2\/media?parent=112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/people.iola.dk\/arj\/wp-json\/wp\/v2\/categories?post=112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/people.iola.dk\/arj\/wp-json\/wp\/v2\/tags?post=112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}