I am working with the SystemC library which requires all user defined types to have a operator<< and sc_trace() function. However the user defined type is actually a nested type inside a template class, because the "nested type" is computed from the template argument specified in the outer class.
template<typename T>
class Block {
typedef typename transform<T>::value NewType;
public:
struct SomeType {
SomeType() {}
SomeType(T val) : member(val) {}
NewType member;
};
};
When I define the operator<< for SomeType like so
template<typename T>
std::ostream& operator<<(std::ostream& os, const typename Block<T>::SomeType& type) {
return os << type.member;
}
The compiler cannot deduce the call inside the systemC library that does attempt to dump the nested defined type using the streaming operator. Since I rather not touch the library code (outside my control). Would any one of you experts out there know a way to work around this?
And if there is no clean workaround, would you know if the C++11 has a solution for this?