Use C++11's native features in preference to Boost

First commit simply backports a related change from the other demo. The other two then replace BOOST_FOREACH and boost::accumulate with the C++11's native versions.