J
Jayden Shui
Hello All,
I have a code like:
template<class T, char open, char close>
class Enclosed
{
public:
Enclosed(T& t) : mT(t) {}
friend ostream& operator<<(ostream& os, Enclosed const& e);
private:
T& mT;
};
template<class T, char open, char close>
ostream& operator<<(ostream& os, Enclosed<T, open, close> const& e)
{
os << open << e.mT << close;
return os;
}
When I test it by
cout << Enclosed<int, '[', ']'>(5);
The compiler said they can not find the operator << function. Would
you please help me to look into it?
Thank you for your kind help!
Best regards,
Jayden
I have a code like:
template<class T, char open, char close>
class Enclosed
{
public:
Enclosed(T& t) : mT(t) {}
friend ostream& operator<<(ostream& os, Enclosed const& e);
private:
T& mT;
};
template<class T, char open, char close>
ostream& operator<<(ostream& os, Enclosed<T, open, close> const& e)
{
os << open << e.mT << close;
return os;
}
When I test it by
cout << Enclosed<int, '[', ']'>(5);
The compiler said they can not find the operator << function. Would
you please help me to look into it?
Thank you for your kind help!
Best regards,
Jayden