Раньше компилялась, а теперь не.... (((
лучше б кусок кода такой же длины выложил
oppa$ cat main.h
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <iomanip>
#include <ctype.h>
#include <stdlib.h>
#define MAX_PATH 1024
#define MAX_LINE 1024
#include "matrix.c" // our matrix template
class cell
{
private:
vector<bool> x;
vector<bool> y;
bool done;
bool black;
int test;
public:
void init(int, int); // grows to required sizes
void out;
void set(int);
bool testit;
void markit(char); // char 'x' or 'y'
void setifdone(char); // char 'x' or 'y'
cell;
~cell;
friend class titem;
friend class jc;
};
class titem // title item class
{
private:
vector<int> items;
vector<int> beg;
int size;
public:
//vector<int> beg;
titem;
~titem{};
void add(int);
int getsize { return this->size; };
int item(int pos) { return this->items[pos]; };
bool move_block(int);
bool test;
void clear{ };
void set{ };
friend class jc;
};
class jc // our main task - JC class
{
private:
string name; // JC name
string fname_in; // JC input file name
int x, y; // JC size
vector<titem> tx; // x-axis title info
vector<titem> ty; // y-axis title info
matrix<cell> *m; // X*Y "battlefield"
int done_count; // counter to follow the developments %
int last_pass;
public:
jc(string); // (1)
~jc;
int init; // (3) inits a "battlefield"
int load_txt; // (2) loads a JC in title structures
int write_html; // output
int process; // resolving problem %)
void process_line(int);
void process_col(int);
bool finish; // true when done_count = x*y
bool progress; // true when two consequent passes differs each other
};
oppa$
oppa$ cat cell.c
#include "main.h"
cell::cell
{
this->x.push_back(0); // inserts a 0(empty)-bit in our boolean vectors
this->y.push_back(0);
this->done = 0;
}
cell::~cell
{
}
void cell::init(int ix, int iy)
{
for(int i=1; i<=ix; i++) this->x.push_back(0);
for(int i=1; i<=iy; i++) this->y.push_back(0);
}
void cell::out
{
for(vector<bool>:: const_iterator p = x.begin; p!=x.end; ++p)
{
cout << *p;
}
cout << "*";
for(vector<bool>:: const_iterator p = y.begin; p!=y.end; ++p)
{
cout << *p;
}
cout << "[" << this->test << "]]]]" << endl;;
}
bool cell::testit
{
if(this->done)
{
ifthis->test == 0) && (!this->black return true;
ifthis->test > 0) && (this->black return true;
return false;
}
else return true;
}
void cell::markit(char ch) // char 'x' or 'y'
{
if(this->test == 0)
{
switch(ch) {
case 'x': this->x[0] = true; break;
case 'y': this->y[0] = true; break;
default: cout << "Bad in cell::markit" << endl;
}
}else
{
switch(ch) {
case 'x': this->x[this->test + 1] = true; break;
case 'y': this->y[this->test + 1] = true; break;
default: cout << "Bad in cell::markit" << endl;
}
}
}
void cell::setifdone(char ch)
{
vector <bool> tmp;
switch(ch) {
case 'x': tmp = &(this->x); break;
case 'y': tmp = &(this->y); break;
default: cout << "Bad in cell::markit" << endl;
}
int lmark_count = 0; // resolved only in case, when only one marked position
for(vector <bool> :: const_iterator p = tmp.begin; p != tmp.end; ++p)
{
if(tmp[p] == true) lmark_count++;
}
if(lmark_count == 1)
{
this->done = true;
if(tmp[0] == 1) this->black = true;
else this->black = false;
}
else if(lmark_count > 1 && tmp[0] == 0)
{
this->done = true;
this->black = true;
}
}oppa$
using namespace std;
thx.
Оставить комментарий
SvinkaVJeansah
Раньше компилялась, а теперь нет...Была freebsd4.10, а стала 5.3. Смена компиляторов плохо повлияла?
У кого-нить есть последние стандарты C++?