After g++ -std=c++0x 'ing std::result_of , the following error message appears
error: 'result_of' in namespace 'std' does not name a type
(g ++ version 4.5.0 on SUSE.)
The corresponding piece of code sufficient to reproduce the error is below
#include <random> #include <type_traits> using namespace std; class Rnd{ protected: static default_random_engine generator_; }; template<class distribution> class Distr: Rnd{ distribution distribution_; public: typename std::result_of<distribution(default_random_engine)>::type operator() (){ return distribution_(default_random_engine); } };
In addition, I tried to compile examples from wikipedia or cpluplus.com to no avail. Is this a problem with a specific compiler or am I doing something wrong?
source share