Usage of `void()` in a comma-separated list?

Viewed 2174

I was looking into a piece of code written by others when I saw this:

a(), void(), b();

where both a and b are instances of a user-defined template class, which is intended to act like a function by overloading operator() that returns the calling instance itself.

Part of the class:

template <typename T>
class SomeClass{
    public:
    SomeClass& operator()(void);
    const SomeClass& operator()(void) const;
}

The return statements for both overloads are the following:

template <typename T>
SomeClass<T>& SomeClass<T>::operator()(void){
    // do stuff
    return *this;
}

template <typename T>
const SomeClass<T>& SomeClass<T>::operator()(void) const{
    // do stuff
    return *this;
}

What does the void() between them do? I feel it strange.

1 Answers
Related