How to correctly use std::reference_wrappers
I am trying to understand std::reference_wrapper . The following code shows that the reference wrapper does not behave exactly like a reference. #include <iostream> #include <vector> #include <functional> int main() { std::vector<int> numbers = {1, 3, 0, -8, 5, 3, 1}; auto referenceWrapper = std::ref(numbers); std::vector<int>& reference = numbers; std::cout << reference[3] << std::endl; std::cout << referenceWrapper.get()[3] << std::endl; // I need to use get ^ // otherwise does not compile. return 0; } If I understand it correctly, the implicit conversion does not apply to calling member