N
Noah Roberts
Input:
template < typename T >
boost::function<void()> f()
{
return []() { typedef typename T::type type; };
}
Output: "typename cannot be used outside a template declaration",
"'T' : is not a class or namespace name"
Input:
template < typename T >
boost::function<void()> f()
{
return []() { typedef T::type type; };
}
Output: "'T' : is not a class or namespace name"
Input:
template < typename T >
struct wtf { typedef typename T::type type; };
template < typename T >
boost::function<void()> f()
{
return []() { typedef typename wtf<T>::type type; };
}
Output: "typename cannot be used outside a template declaration"
Input:
template < typename T >
struct wtf { typedef typename T::type type; };
template < typename T >
boost::function<void()> f()
{
return []() { typedef wtf<T>::type type; };
}
Output: success (assuming T has a type in it)
So the question is, am I doing something wrong or is the compiler just
confused? What of these is correct?
template < typename T >
boost::function<void()> f()
{
return []() { typedef typename T::type type; };
}
Output: "typename cannot be used outside a template declaration",
"'T' : is not a class or namespace name"
Input:
template < typename T >
boost::function<void()> f()
{
return []() { typedef T::type type; };
}
Output: "'T' : is not a class or namespace name"
Input:
template < typename T >
struct wtf { typedef typename T::type type; };
template < typename T >
boost::function<void()> f()
{
return []() { typedef typename wtf<T>::type type; };
}
Output: "typename cannot be used outside a template declaration"
Input:
template < typename T >
struct wtf { typedef typename T::type type; };
template < typename T >
boost::function<void()> f()
{
return []() { typedef wtf<T>::type type; };
}
Output: success (assuming T has a type in it)
So the question is, am I doing something wrong or is the compiler just
confused? What of these is correct?