<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Object Mentor Blog: C++ Algorithms, Boost and function currying</title>
    <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>C++ Algorithms, Boost and function currying</title>
      <description>&lt;p&gt;I&amp;#8217;ve been experimenting with C++ using the Eclipse &lt;span class="caps"&gt;CDT&lt;/span&gt; and gcc 4.4. Since I&amp;#8217;m a fan of boost, I&amp;#8217;ve been using that as well. I finally got into I realistic use of boost::bind.&lt;/p&gt;


I converted this:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;int Dice::total() const {
  int total = 0;

  for(const_iterator current = dice.begin();
      current != dice.end();
      ++current)
    total += (*current)-&amp;gt;faceValue();

  return total;
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
Into this:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;int Dice::total() const {
  return std::accumulate(
      dice.begin(),
      dice.end(),
      0,
      bind(std::plus&amp;lt;int&amp;gt;(), _1, bind(&amp;amp;Die::faceValue, _2))
  );
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;To see how to go from the first version to the final version with lots of steps in between: &lt;a href="http://schuchert.wikispaces.com/cpptraining.SummingAVector"&gt;http://schuchert.wikispaces.com/cpptraining.SummingAVector&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;This is a first draft. I&amp;#8217;ll be cleaning it up over the next few days. If you see typos, or if anything is not clear from the code, please let me know where. Also, if my interpretation of what boost is doing under the covers (there&amp;#8217;s not much of that) is wrong, please correct me.&lt;/p&gt;


	&lt;p&gt;Thanks!&lt;/p&gt;</description>
      <pubDate>Sat, 12 Jun 2010 23:41:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:549aae6e-42fc-4ae7-ad78-126667918e8d</guid>
      <author>Brett Schuchert</author>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying</link>
      <category>Schuchert's Scattered Synapses </category>
      <category>c</category>
      <category>cpp</category>
      <category>boost</category>
      <category>function</category>
      <category>currying</category>
      <category>std</category>
      <category>for_each</category>
      <category>vector</category>
      <category>shared_ptr</category>
      <category>accumulate</category>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by UGG pas cher </title>
      <description>Tout d&#8217;accord sur votre opinion. Et moi, aussi le fan de &amp;lt;a href=&amp;#8221;&lt;a href="http://www.uggbottessoldes.com" rel="nofollow"&gt;http://www.uggbottessoldes.com&lt;/a&gt;&amp;#8221; 

	&lt;p&gt;target=&amp;#8221;_blank&amp;#8221;&amp;gt;bottes uggs, surtout sur sa doublure en laine. La marque &lt;a href="http://www.uggbottessoldes.com" rel="nofollow"&gt;


	&lt;p&gt;target=&amp;#8221;_blank&amp;#8221;&amp;gt;ugg bottes&lt;/p&gt;&lt;/a&gt;.  venait de trouver sa signature. En ce moment, vous pouvez pr&#233;-commander les &lt;a&gt;


	&lt;p&gt;href=&amp;#8221;&lt;a href="http://www.uggbottessoldes.com" rel="nofollow"&gt;http://www.uggbottessoldes.com&lt;/a&gt;&amp;#8221; target=&amp;#8221;_blank&amp;#8221;&amp;gt;UGG Soldes&lt;/p&gt;&lt;/a&gt;!&lt;/p&gt;</description>
      <pubDate>Tue, 07 Sep 2010 03:45:04 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:81d3dbe0-5fd1-4d24-8c00-f78099eeaba5</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-24629</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by dupont lighter</title>
      <description>&lt;p&gt;&lt;a href="http://dupontlighter.net/" rel="nofollow"&gt;dupont lighter&lt;/a&gt;, &lt;a href="http://dupontlighter.net/" rel="nofollow"&gt;dupont lighters&lt;/a&gt;, &lt;a href="http://dupontlighter.net/" rel="nofollow"&gt;st dupont lighter&lt;/a&gt;, &lt;a href="http://dupontlighter.net/" rel="nofollow"&gt;s.t. dupont lighters&lt;/a&gt;.
Some actually seem like they are created with space creatures &#8211; not real women &#8211; in mind. But this fall, designers rolled out a multitude of great wearable looks.&lt;/p&gt;</description>
      <pubDate>Sun, 05 Sep 2010 20:50:53 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:0bb290c4-60c7-428e-89ae-3f6ffb2e66eb</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-24214</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by armani belt</title>
      <description>&lt;p&gt;&lt;a href="http://armanibelts.com/" rel="nofollow"&gt;armani belt&lt;/a&gt;, &lt;a href="http://armanibelts.com/" rel="nofollow"&gt;armani belts&lt;/a&gt;, &lt;a href="http://armanibelts.com/" rel="nofollow"&gt;armani belts for men&lt;/a&gt;, &lt;a href="http://armanibelts.com/" rel="nofollow"&gt;armani mens belt&lt;/a&gt;.
Classic fashion styles are the looks that last through the ages and appear flattering on almost anyone. They go beyond trends and are a triumph of art. Despite the decade, figure or fashion, classic styles are always a demonstration of truly refined taste.&lt;/p&gt;</description>
      <pubDate>Sun, 05 Sep 2010 20:50:10 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:3f734b21-564c-4a07-ac2d-19e7eac66e7d</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-24211</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by Men&#8217;s belts</title>
      <description>&lt;p&gt;&lt;a href="http://mens-belts.net/" rel="nofollow"&gt;Men&#8217;s belts&lt;/a&gt;, &lt;a href="http://mens-belts.net/" rel="nofollow"&gt;LV men&#8217;s belts&lt;/a&gt;, Fashionable &lt;a href="http://mens-belts.net/" rel="nofollow"&gt;Gucci men&#8217;s belts&lt;/a&gt;, Attractive style &lt;a href="http://mens-belts.net/" rel="nofollow"&gt;Hermes men&#8217;s belts&lt;/a&gt;.&lt;br&gt;
Today fashion and beauty can be affordable for everyone. There is always a range such as Avon that provides quality beauty, make up and accessory products at a prices most can afford. Mass fashion is moving so fast that fashion now moves in a weekly cycle and fashion trends are hot for a short time only.&lt;/p&gt;</description>
      <pubDate>Sun, 05 Sep 2010 20:49:46 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:fe5bd350-9dc4-4ccf-8f59-335cb4568a60</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-24208</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by Hermes belt</title>
      <description>&lt;p&gt;&lt;a href="http://hermesbelt.net/" rel="nofollow"&gt;Hermes belts&lt;/a&gt;, Elegant &lt;a href="http://hermesbelt.net/" rel="nofollow"&gt;Hermes belt&lt;/a&gt;, Fashion &lt;a href="http://hermesbelt.net/" rel="nofollow"&gt;Hermes belts for men&lt;/a&gt;, &lt;a href="http://hermesbelt.net/" rel="nofollow"&gt;Hermes mens belt&lt;/a&gt;.&lt;br&gt;
Today fashion and beauty can be affordable for everyone. There is always a range such as Avon that provides quality beauty, make up and accessory products at a prices most can afford. Mass fashion is moving so fast that fashion now moves in a weekly cycle and fashion trends are hot for a short time only.&lt;/p&gt;</description>
      <pubDate>Sun, 05 Sep 2010 20:49:18 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:184ca17f-c7a6-438c-a0b9-b7b5d119b08b</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-24206</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by gucci wallet</title>
      <description>&lt;p&gt;&lt;a href="http://gucciwallet.org/" rel="nofollow"&gt;gucci wallet&lt;/a&gt;, &lt;a href="http://gucciwallet.org/" rel="nofollow"&gt;gucci wallets&lt;/a&gt;, &lt;a href="http://gucciwallet.org/" rel="nofollow"&gt;mens gucci wallet&lt;/a&gt;, &lt;a href="http://gucciwallet.org/" rel="nofollow"&gt;women gucci wallet&lt;/a&gt;.&lt;br&gt;
The continually changing fashions of the West have been generally unparalleled either in antiquity or in the other great civilizations of the world until recent decades.&lt;/p&gt;</description>
      <pubDate>Sun, 05 Sep 2010 20:48:55 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:dc06baa0-2ec6-476e-b975-b2767c709208</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-24204</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by louis vuitton wallet</title>
      <description>&lt;p&gt;&lt;a href="http://louisvuitton-wallet.com/" rel="nofollow"&gt;louis vuitton wallet&lt;/a&gt;, &lt;a href="http://louisvuitton-wallet.com/" rel="nofollow"&gt;louis vuitton wallets&lt;/a&gt;, &lt;a href="http://louisvuitton-wallet.com/" rel="nofollow"&gt;mens louis vuitton wallet&lt;/a&gt;, &lt;a href="http://louisvuitton-wallet.com/" rel="nofollow"&gt;women louis vuitton wallet&lt;/a&gt;.&lt;br&gt;
Traditional country, Southwestern prints and modern city styles elegantly merge in a new collection of men&amp;#8217;s-wear by Highland.&lt;/p&gt;</description>
      <pubDate>Sun, 05 Sep 2010 20:48:38 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:34a404eb-443e-420b-a3af-7bcc760fb3a0</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-24202</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by supplynflshop</title>
      <description>&lt;p&gt;good post and thanks
&lt;a href="http://www.supplynflshop.com" rel="nofollow"&gt;http://www.supplynflshop.com&lt;/a&gt; cheap nfl jerseys&lt;/p&gt;</description>
      <pubDate>Tue, 31 Aug 2010 21:18:03 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:94190c91-5e80-4f7d-84d0-c487626b82c3</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-23376</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by Leucadia Real Estate</title>
      <description>&lt;p&gt;I made that erroneous change and I had a failing unit test &#8211; so no thought experiment, I know with certainty that your subtle error isn&#8217;t so subtle at all&#8230;&amp;#8230;............&lt;/p&gt;</description>
      <pubDate>Sun, 22 Aug 2010 11:06:25 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:bc11bb89-641e-4471-8e07-9a380fa8399b</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-21422</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by Mission Hills Real Estate</title>
      <description>&lt;p&gt;I made that erroneous change and I had a failing unit test &#8211; so no thought experiment, I know with certainty that your subtle error isn&#8217;t so subtle at all&amp;#8230;...............&lt;/p&gt;</description>
      <pubDate>Sat, 14 Aug 2010 12:16:47 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:d6821070-233e-4d3a-bb99-8296506dd83a</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-19976</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by cosplay</title>
      <description>&lt;p&gt;The noblest search is the search for excellence&lt;/p&gt;</description>
      <pubDate>Tue, 10 Aug 2010 21:27:21 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:b70d2e86-4209-49ea-9c17-a16ac177f527</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-19509</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by lady dress</title>
      <description>&lt;p&gt;Wholesale clothing,fashion dress,lady dress,lady garment,lady fashion&lt;/p&gt;</description>
      <pubDate>Tue, 20 Jul 2010 03:26:39 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:c1cc9ca2-cbaa-4d58-b6f9-62d470f4d3c7</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-16937</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by Halter</title>
      <description>&lt;p&gt;Sunshine of summer, the beautiful flower asperses full whole body, sweet and elegant breath, the circulation of the spread of elegant silk &lt;a href="http://www.ququgofashion.com" rel="nofollow"&gt;dress &lt;/a&gt;  eyes from the waves to linger flying&lt;a href="http://www.lydress.com" rel="nofollow"&gt; skirt &lt;/a&gt; . A gentle and graceful elasticity waist foil, more show delicate temperament of your daughter beauties.&lt;/p&gt;</description>
      <pubDate>Mon, 19 Jul 2010 05:14:04 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:ec7d72c1-56b6-4a32-a0b1-a36bd9b07680</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-16811</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by garments</title>
      <description>&lt;p&gt;&lt;a href="www.lydress.com" rel="nofollow"&gt;clothing&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 13 Jul 2010 21:17:24 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:1cd9724a-5dae-4f81-8b41-63592c14bd95</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-16192</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by human</title>
      <description>&lt;p&gt;I do agree the syntax is a bit verbose and difficult which is a threshold for beginners, but I think/hope lambda expressions will help with that.&lt;/p&gt;</description>
      <pubDate>Mon, 12 Jul 2010 02:06:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:b6513969-c53e-438a-8c86-b3a867f1a289</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-16013</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by Olivea Copper</title>
      <description>&lt;p&gt;Through my 27 years of infinite wisdom (my parents always said I was a smart-ass), I&amp;#8217;ve learned a few things. Women, yea I consider myself an expert in the female area if you know what I mean (wink) &amp;#8211; and the most important thing I&amp;#8217;ve learned is to stay away from a woman on her PMS days. In fact, I&amp;#8217;ve put together a few acronyms (abbreviations) based on my experience with the syndrome.&lt;/p&gt;</description>
      <pubDate>Thu, 08 Jul 2010 05:59:27 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:4b9f30b1-b413-4723-a783-f73ce2f21769</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-15912</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by http://www.laviesolar.com</title>
      <description>&lt;p&gt;Great web site. Than you for the information&lt;/p&gt;</description>
      <pubDate>Tue, 06 Jul 2010 03:20:39 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:16f29cc9-8934-4c4e-872e-da6a94881f70</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-15406</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by Birkenstock</title>
      <description>&lt;p&gt;thanks for your sharing, very good news.&lt;/p&gt;</description>
      <pubDate>Thu, 01 Jul 2010 22:45:54 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:44febbf3-3e73-43b3-bc51-b4c55d5931f3</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-14982</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by r9 irons</title>
      <description>&lt;p&gt;The noblest search is the search for excellence&lt;/p&gt;</description>
      <pubDate>Tue, 29 Jun 2010 04:11:53 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:c15c1e5c-0d24-448b-83fa-bfc33989faa5</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-14633</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by pump shoes</title>
      <description>&lt;p&gt;It seems that you have set many work in to your article and We require more of&lt;/p&gt;


	&lt;p&gt;those about the net presently. I truly got a drag out of one&amp;#8217;s article. We do not&lt;/p&gt;


	&lt;p&gt;actually possess a lot in order to communicate reacting, I just wished to comment&lt;/p&gt;


	&lt;p&gt;in order to respond incredible perform&lt;/p&gt;</description>
      <pubDate>Tue, 29 Jun 2010 03:54:57 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:63e628da-7d04-445f-ac4e-55172723dad8</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-14564</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by cell phone headset</title>
      <description>&lt;p&gt;Nice one. I have stumbled and twittered this for my friends. Hope others find it as interesting as I did.&lt;/p&gt;</description>
      <pubDate>Tue, 29 Jun 2010 03:34:03 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:d881afac-04e0-4f4d-a176-733ea7e51c01</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-14535</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by galbur</title>
      <description>&lt;p&gt;the use of boost in this example is making for worse code.&lt;/p&gt;</description>
      <pubDate>Mon, 28 Jun 2010 07:57:38 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:b51867a1-6a6b-4551-a5da-8e8e2e53d8eb</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-14500</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by Peach</title>
      <description>&lt;p&gt;I also prefer the first version. I is an easy, clear code that works properly. I don&amp;#8217;t think that the second has a lot of advantages, in my opiniton the amenity of the first one ist clear and so I would choose this one.&lt;/p&gt;</description>
      <pubDate>Fri, 25 Jun 2010 09:22:26 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:7addbaa4-98b4-477d-b3c3-447d2380b2e0</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-14072</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by Steve</title>
      <description>&lt;p&gt;The usage of iterators in the second version shows that the author of this post doesn&amp;#8217;t understand the concepts of abstraction and of functional programming very well.&lt;/p&gt;</description>
      <pubDate>Sat, 19 Jun 2010 05:38:35 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:02f7bd59-5630-40f0-9ec6-0f9d8cd76a2e</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-13207</link>
    </item>
    <item>
      <title>"C++ Algorithms, Boost and function currying" by Tim Smith</title>
      <description>&lt;p&gt;When Scott first wrote about why hand written loops are evil compared to the new style of doing things, he made three important points.  Sadly, he made three huge mistakes.&lt;/p&gt;


	&lt;p&gt;1) He said it was easier to write correct code.  He took a simple handle written loop that was incorrect and make multiple attempts at making a new style loop.  Sadly, it would have taken one step to correct the hand written loop.&lt;/p&gt;


	&lt;p&gt;2) He said it was easier to write correct code (part 2).  In his newly created &amp;#8220;correct&amp;#8221; routine, he incorrectly used  as part of the code to select the proper template.  Sadly, his input data was doubles.  What would have been a trivial bug to catch in unit tests now becomes a more subtle bug to catch.  (For example, inputs of 1,2,3 wouldn&amp;#8217;t catch Steve&amp;#8217;s bug, but 1.4,2.8,3.9 would have)&lt;/p&gt;


	&lt;p&gt;3) He said that the new fancy code ran just as fast.  Sadly, it did not.  Due to the complexity of the template code, the optimizer failed to place a temporary in a register thus resulting in the routine using stack space.  The new fancy version ran THREE TIMES SLOWER than the hand written loop.  (template optimizers have improved a lot since then)&lt;/p&gt;</description>
      <pubDate>Tue, 15 Jun 2010 15:05:28 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:f8f928a1-726d-43bc-b050-ac796f191182</guid>
      <link>http://blog.objectmentor.com/articles/2010/06/12/c-algorithms-boost-and-function-currying#comment-13141</link>
    </item>
  </channel>
</rss>
