求助STL-list的用法?
//=========================================================================
// "树"形的结构-->每一个结点里都放有X和Y两坐标值,z是2d旋转,
// O结点-----O子结点-----O子子
// | |
// O根---------| |-----O
// | |
// | |-----O
// O结点
//
//
//往每个结点设置参数,而后通过"树"的顺序获取,插入时的顺序和读取时一样,
//例如,设置时 根里(0,0),(-10,10),(10,10),结点(-10,-10),(10,-10),(10,10),(-10,10).....
// 读取时先是获得根(0,0),(-10,10),(10,10),在结点...
//==========================================================================
#pragma warning(disable:4786)
#include <algorithm>
#include <vector>
#include <iostream>
#include <string>
#include <list>
#include <functional>
using namespace std;
struct{ //结构是否要加结点标识?
double x;//X轴坐标
double y;//Y轴坐标
double z;
int no;//结点标识
}T;
typedef struct T
{
double x;
double y;
double z;
int no;
bool operator <(T &t) //重载
{
return (this->no) < (t.no);
}
}T;
bool less_lower(const string &str1, const string &str2)//排序
{
int len = str1.length() < str2.length() ? str1.length() : str2.length();
for(int i = 0; i <= len; i++)
{
if(tolower(str1[i]) != tolower(str2[i]))
{
return tolower(str1[i]) < tolower(str2[i]) ? true : false;
}
}
return true;
}
void main()
{
T t;
list <T> lt;
for(int i = 0; i < 10; i++)
{
lt.push_back(i); //插入元素到结点
}
//排序,按照链表顺序读取
sort(lt.begin(),lt.end(),less_lower);
}
请问要怎么去实现?