-2

We can't make a vector of references.

See already answered question.

valentin
  • 2,596
  • 6
  • 28
  • 48
  • You cannot have a vector of references the same way you cannot have an array of references. – DeiDei Oct 05 '17 at 11:40
  • Just like you can't have a reference to a reference you also cannot have a container of references, – NathanOliver Oct 05 '17 at 11:42
  • I suspect that you believe that C++ references are like references in some other languages, like Java, C#, or Python. The only thing they really have in common is the name. – molbdnilo Oct 05 '17 at 11:51

1 Answers1

2

vector doesn't support reference. you might use std::reference_wrapper or pointers instead.

Jarod42
  • 203,559
  • 14
  • 181
  • 302