// list_.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <list>
#include <iterator>
#include <iostream>
class Node
{
public:
int id;
Node(int _id){id = _id;};
};
int _tmain(int argc, _TCHAR* argv[])
{
std::list<Node> nd;
std::list<Node>::iterator it;
Node te(3);
nd.push_back(te);//insert
std::list<Node>::iterator node_itor = nd.begin();
for(;node_itor!= nd.end();node_itor++)
{
if(node_itor._Mynode()->_Myval.id == 3)
std::cout<<node_itor._Mynode()->_Myval.id;
}
return 0;
}
//
#include "stdafx.h"
#include <list>
#include <iterator>
#include <iostream>
class Node
{
public:
int id;
Node(int _id){id = _id;};
};
int _tmain(int argc, _TCHAR* argv[])
{
std::list<Node> nd;
std::list<Node>::iterator it;
Node te(3);
nd.push_back(te);//insert
std::list<Node>::iterator node_itor = nd.begin();
for(;node_itor!= nd.end();node_itor++)
{
if(node_itor._Mynode()->_Myval.id == 3)
std::cout<<node_itor._Mynode()->_Myval.id;
}
return 0;
}
assign() 给list赋值