Question

I was browsing through Nano-signal-slot source code and hoping it could help me implement signals and slots functionality into my application using C++11 and I came across a portion of code that I haven't seen before.

Portion of code:

/* ... */

template <typename Re_t> class function;
template <typename Re_t, typename... Args>
class function<Re_t(Args...)>
{
    void *m_this_ptr;
    Re_t(*m_stub_ptr)(void*, Args...);

/* ... */

More specifically:

class function<Re_t(Args...)>

What does do after the class name?

Was it helpful?

Solution

class function<Re_t(Args...)> defines a partial specialization of the templated class function<T>. Basically this allows you to write a specialization in the form of a functor, such as:

function<int(double,unsigned)> foo = ...

Note that you can have a variable number of arguments due to the use of Args....

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top