c++ - Get std::list by reference -


i have poly3d class in c++, has sole member: list<point_3>

using namespace std;  struct poly3d { public:     poly3d(const list<point_3> &ptlist);   private:     list<point_3> ptlist;  }; 

my question is, how ( in sense of c#) reference, same copy returned every time access poly3d.ptlist?

#include <list> using namespace std;  struct point_3{ };  struct poly3d { public:     poly3d(const list<point_3> &ptlist);     list<point_3>& getpointlist();   private:     list<point_3> ptlist;  };  list<point_3>& poly3d::getpointlist(){     return ptlist; }  int main(void){     list<point_3> mylist;     poly3d mypoly(mylist);     list<point_3>& mylistref = mypoly.getpointlist(); } 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -