S
subramanian100in
For vector and deque, the memory layout may be contiguous in which
case we cannot have array of references and so we cannot have
vector<int&> and deque<int&>. Am I correct?
However I am unable to create
list<int&> c;
Though 'list' does not involve contiguous memory layout, the above is
disallowed because we cannot reseat a reference(in the sense that we
cannot rebind a reference to a different object through assignment
operator). Is the reasoning correct; or is there some other reason for
disallowing list of references.
Kindly clarify.
Thanks
V.Subramanian
case we cannot have array of references and so we cannot have
vector<int&> and deque<int&>. Am I correct?
However I am unable to create
list<int&> c;
Though 'list' does not involve contiguous memory layout, the above is
disallowed because we cannot reseat a reference(in the sense that we
cannot rebind a reference to a different object through assignment
operator). Is the reasoning correct; or is there some other reason for
disallowing list of references.
Kindly clarify.
Thanks
V.Subramanian