Hi,
here's the situation: I have a template class, one of its method
returns the type specified in the template (see Entry<T>::getData()).
Problem is, I can't convert its return type to pointer.
In method "cetak", the lines: "T* ptr = &(v[0]->getData())" produces
compile error: "error: non-lvalue in unary `&'".
If, I change the line to: "T* ptr = &(v[0]->data), I got no error.
===========================================
#include <iostream>
#include <vector>
using namespace::std;
template<typename T>
class Entry {
public:
T getData() const;
T data;
};
template<typename T>
T Entry<T>::getData() const {
return data;
}
typedef Entry<int> ei;
template<typename T>
void cetak(int i, const vector