jeudi 28 avril 2016

How can I properly re-write c++11 lamda experssion without lamda expr

I have a following code:

class Variant
{
public:
    void init();
}

void Variant::init()
{
    int var 1;
    vector list;
    vector list2;

    tbb::parallel_for(tbb::blocked_range<std::size_t>(0, list.size(), ClrSize),
    [this, &var1, &list,&list2](const tbb::blocked_range<std::size_t> &range)
    {
        /*some code here*/
    }

I thought about implementing operator()(const tbb::blocked_range &range)

class Variant
{
public:
    void operator()(const tbb::blocked_range<std::size_t> &range)
    {
        /*some code here*/
    }
    void init();
}

void Variant::init()
{
    int var 1;
    vector list;
    vector list2;

    tbb::parallel_for(tbb::blocked_range<std::size_t>(0, list.size(), ClrSize), this);
}

but it doesn't solve capture list problem.

How I can re-write lamda expression? What can I do with var1, list, list2 arguments?

Thanks

Aucun commentaire:

Enregistrer un commentaire