如何优化此代码并获取访问权限? [英] how to optimize this code and getting access to it ?
本文介绍了如何优化此代码并获取访问权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
i want to implement a vector that has a type of matrices and this matrices has a type of a list of class(class name:classe) so
i create a class schedule and a type of list of class like this:
/*
* schedule.h
*
* Created on: 29 Oct 2015
* Author: Latitude
*/
#ifndef SCHEDULE_H_
#define SCHEDULE_H_
#include <string>
#include "Classe.h"
#include <list>
typedef std::list<Classe*> ClasseListeType;
class schedule {
public:
schedule;
virtual ~schedule();
ClasseListeType GetMat(int i,int j) { return *Mat[i][j]; }
private:
std::string _lannee;
int nbrofdays;
int nbrofslots;
ClasseListeType* Mat[nbrofdays][nbrofslots] ;
//std::list<Classe*> _listedsclasse;
//Mat[nbrdsjours][nbrdsperiods];
};
#endif /* SCHEDULE_H_ */
和我用这个代码填写时间表清单
and i fill the Schedule list by this code
Classe
c1(1,1,&p1,&g1,&m1),
c2(2,2,&p1,&g1,&m4),
c3(3,3,&p1,&g1,&m5),
c4(4,1,&p2,&g1,&m2),
c5(5,2,&p2,&g1,&m6),
c12(12,2,&p4,&g1,&m8),
c13(13,1,&p4,&g1,&m7),
c6(6,1,&p1,&g2,&m1),
c7(7,2,&p1,&g2,&m4),
c8(8,3,&p1,&g2,&m5),
c9(9,1,&p2,&g2,&m2),
c11(11,2,&p2,&g2,&m6),
c14(14,1,&p4,&g2,&m7);
Schedule lp;
lp.GetMat(0,0).push_back(&c1);
lp.GetMat(0,0).push_back(&c9);
lp.GetMat(0,1).push_back(&c3);
lp.GetMat(0,2).push_back(&c4);
lp.GetMat(0,3).push_back(&c7);
lp.GetMat(0,1).push_back(&c6);
lp.GetMat(0,4).push_back(&c8);
lp.GetMat(0,2).push_back(&c2);
lp.GetMat(0,4).push_back(&c11);
lp.GetMat(0,3).push_back(&c13);
vector<Schedule*>
所以我对这段代码不太确定
So i'm not so sure for this code
because it seems so complicated and i have to manage
this code with genetic algorithm and
向量< Schedule *>管理
这段代码。将是染色体
我如何以简单的方式访问此列表?
所以我的代码上有一个错误的错误或者我错误的方式
plz帮助我优化它;
坦克i advenced
vector<Schedule*> will be the chromosome
how do i acces this lists in easy way ??
so is there an eny erreur on my code or i didt in a wrong way
plz help me to optimize it;
tanks i advenced
推荐答案
请不要重新发布同样的问题;使用改善问题链接来编辑原文。
Please do not repost the same question; use the Improve question link to edit your original.
这篇关于如何优化此代码并获取访问权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文