|
아직 이해가 안가네요...
저의 무지함을 느끼는군요...
좀 초보자 입장에서 자세하게 설명해 주시면 감사하겠습니다.
새더군 님이 쓰신 글 :
: 안녕하세요..
: vector 에서 데이터간 이동은.. 이터레이터를 사용합니다.
:
: 이터레이터란 c 나 c++ 에서 사용하는 포인터와 비슷 하게 사용하면 되구요
: vector를 비롯한 STL에서 제공하는 컨테이너들은 begin 과 end 라는 멤버 펑션으로 데이터의 시작과
: 끝을 나타낼수 있는 이터레이터를 반환 합니다.
:
: vector<port_info>::iterator PortIt;
: PortIt = PortInfo.end();
:
: 그럼 좋은 하루 되세요
:
:
: 민인학 님이 쓰신 글 :
: : struct port_info {
: : char *PortName;
: : int PortWidth;
: : int PortDir;
: : int PortType;
: : };
: :
: : vector<port_info> PortInfo;
: :
: : 위와 같은 vector가 있을때....
: :
: :
: : port_info port;
: :
: : (첫번째추가)
: : port.PortName = strdup(t_port->name);
: : port.PortWidth = t_port->bw;
: : port.PortDir = t_port->dir;
: : port.PortType = t_port->attr;
: : PortInfo.push_back(port);
: :
: : (두번째추가)
: : port.PortName = strdup(t_port->name);
: : port.PortWidth = t_port->bw;
: : port.PortDir = t_port->dir;
: : port.PortType = t_port->attr;
: : PortInfo.push_back(port);
: :
: : (세번째추가)
: : port.PortName = strdup(t_port->name);
: : port.PortWidth = t_port->bw;
: : port.PortDir = t_port->dir;
: : port.PortType = t_port->attr;
: : PortInfo.push_back(port);
: :
: : (네번째추가)
: : port.PortName = strdup(t_port->name);
: : port.PortWidth = t_port->bw;
: : port.PortDir = t_port->dir;
: : port.PortType = t_port->attr;
: : PortInfo.push_back(port);
: :
: : 나중에 검색을할때... 끝을 검색할려면 어똫게 해야하죠?
: :
: : int x = 0;
: : while(1) {
: : printf( "%s\n", PortInfo[x].PortName );
: : x++;
: : }
: :
: : 위와 같이 하니 죽어버리는데...
: : vector의 끝을 검사할려면 어떻게 해야하죠?
|