So I'm still kind of figuring out the semantics of C++ references here.
I have a class that has a reference as a member, and I initialize the reference in the constructor.
template<class T>
class AVLNode {
private:
T & data;
public:
AVLNode(T & newData) {
data = newData;
}
};
But I get this error on the constructor line:
error: uninitialized reference member ‘AVLNode<int>::data’ [-fpermissive]
I don't get this, I initialize the reference as soon as the class is constructed so there shouldn't be a problem with the reference being uninitialized right?