PPL algorithm sample

Sample showing PPL algorithms.

#include <ppl.h>
#include <concurrent_vector.h>
#include <concurrent_queue.h>
 
using namespace Concurrency;
 
// =================================================================================================
 
void algo_parallel_for(int* buffer, size_t size)
{
    parallel_for((size_t)0, size, /*(size_t)1, */
                 [&](size_t i) { buffer[i] = i*2; });
}
 
// =================================================================================================
 
void algo_parallel_for_each()
{
    std::array<int, 16> arr;
    algo_parallel_for(&arr[0], arr.size());
    parallel_for_each(arr.begin(), arr.end(),
                      [&](int value) { std::cout << value << std::endl; });
}
 
// =================================================================================================
 
void algo_parallel_invoke()
{
    std::cout << "Starting tasks" << std::endl;
    parallel_invoke( [&]() { std::cout << "0 starting" << std::endl; ::Sleep(1000*1); },
                     [&]() { std::cout << "1 starting" << std::endl; ::Sleep(1000*2); },
                     [&]() { std::cout << "2 starting" << std::endl; ::Sleep(1000*3); },
                     [&]() { std::cout << "3 starting" << std::endl; ::Sleep(1000*4); });
    std::cout << "Tasks done" << std::endl;
}