Fix undeclared 'typeof' when compiling with -std=c++11

I am compiling my plugins with -std=c++11 because I use some stuff only available in C++11. It looks like "typeof" is undeclared when compiling with -std=c++11, which cause errors in threadtools.h.
typeof equivalent in C++11 is decltype. I have attached a patch which detect if C++11 is enabled and use decltype instead of typeof.