Skip to content

amarmer/VoidParam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 

Repository files navigation

VoidParam Puzzle

Published in https://isocpp.org/blog/2016/06/voidparam-puzzle2

In the code:

template <typename T> void Process(const T& t) {} 

#define PROCESS(x) Process(x)

PROCESS can be called with any parameter except void, for instance code bellow won't compile:

void GetVoid() {}

PROCESS(GetVoid())

What modifications should be made in the implementation of macro PROCESS that for all parameters other than void, it works as before, but call PROCESS(GetVoid()) (as well as PROCESS(void())) throws exception that void is not allowed as a parameter. Function Process above should remain without modifications.

About

VoidParam puzzle

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages