Folks,

I'm having some trouble with overloading the '<<' operator for a templated class. For example, given a very simple template class like this:

template<class T = double> class Real
	{
		T	m_value;
	public:
		Real( T val = 0 ){
			m_value = val;
		}
		T get() const {
			return m_value;
		}
	};

This class rests inside a namespace. I've looked at the code in the <complex> header but I really want a simpler block than that. The template parameter could be int, float, etc.

Halp!

Thanks...
Sean

which part of overloading the << operator are you having
trouble with?

your prototype could be something like this :

std::ostream& operator<<(std::ostream& os, Real<T>& real);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.