You've gotten the syntax all wrong. Look at this simple template:
Code:
template <class type_t>
class container
{
public:
container(const type_t & other = type_t()) // default construct
{
*this = other;
}
container(const container<type_t> & other)
{
*this = other;
}
const container<type_t> &
operator = (const container<type_t> & other)
{
rep = other.rep;
return *this;
}
const type_t &
operator = (const type_t & other)
{
rep = other;
return rep;
}
type_t & get()
{
return rep;
}
type_t rep;
};
Does that make more sense?