1

What's wrong with this C++ code ? std::vector<const A &> is not ok but std::vector<const A *> is right

    class A{};
    A array[10];
    std::vector<const A &> fun(){
     std::vector<const A &> ret;
        for(int i=0;i<10;i++){
            ret.push_back(arr[i]);
        }
        return ret;
    }
Pete Becker
  • 72,338
  • 6
  • 72
  • 157

0 Answers0