خرید بک لینک

Vote count: 0

I am thinking about following problem.

Let us have a merging function for merge arrays defined in following way:

// input is (const void*, size_t,  const void*, size_t,...)
template<typename...ARGS>
MyArray Concatenation(ARGS...args)

And let us have couple of structs with static properties

struct A { void* DATA; size_t SIZE; };
struct B { void* DATA; size_t SIZE; };
struct C { void* DATA; size_t SIZE; };

I would like to have a method:

template<typename...ARGS>
MyArray AutoConcatenation();

Where ARGS should be structs with mentioned static interface.

My question is how to implement parameter pack expansion.

I tried:

// not working
template<typename...ARGS>
MyArray AutoConcatenation()
{
  retu Concatenation((ARGS::DATA, ARGS::SIZE)...);
}

What about expansions

ARGS::DATA... // Correct expansion of pointers
ARGS::SIZE... // Correct expansion of sizes
(ARGS::DATA, ARGS::SIZE)... // Seems to be expansion of sizes

Just info for advisors. I am looking for implementation of AutoConcatenation method, not for its redeclaration nor for redeclaration previous code, thank you.

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 12 ارديبهشت 1395 ساعت: 5:04

صفحه بندی