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
  • 74,985
  • 8
  • 76
  • 165

0 Answers0