Re: Compile error in table.h

2000-05-08 Thread Lars Gullik Bjønnes
"Asger K. Alstrup Nielsen" <[EMAIL PROTECTED]> writes: | > Lars> You cannot use a constructor on an array allocation. | > | > Aa! So my compiler is correct! I must say though that this is bad design by | > the standards commitee, (IMHO of course). | | Actually, it is possible to use a const

Re: Compile error in table.h

2000-05-07 Thread Asger K. Alstrup Nielsen
> Lars> You cannot use a constructor on an array allocation. > > Aa! So my compiler is correct! I must say though that this is bad design by > the standards commitee, (IMHO of course). Actually, it is possible to use a constructor on an array allocation. This is called "placement new". Read

Re: Compile error in table.h

2000-05-05 Thread Juergen Vigna
On 05-May-2000 Andre Poenitz wrote: >> No but the cellstruct does have an entry "TextInset * inset" and I >> need to assign this with "inset = new TextInset(buffer)" so if I do: > > Is it really necessary to store a pointer there or could the cellstruct > be changed to hold the TextInset itself?

Re: Compile error in table.h

2000-05-05 Thread Lars Gullik Bjønnes
Juergen Vigna <[EMAIL PROTECTED]> writes: | On 05-May-2000 Lars Gullik Bjønnes wrote: | > Juergen Vigna <[EMAIL PROTECTED]> writes: | > | >| as I have to allocate the insets in the Init() function (otherwise the | >| above construction of the cellstruct-vector fails as I have 1 inset for | >| al

Re: Compile error in table.h

2000-05-05 Thread Andre Poenitz
> No but the cellstruct does have an entry "TextInset * inset" and I > need to assign this with "inset = new TextInset(buffer)" so if I do: Is it really necessary to store a pointer there or could the cellstruct be changed to hold the TextInset itself? In this case you could save all the trouble

Re: Compile error in table.h

2000-05-05 Thread Juergen Vigna
On 05-May-2000 Lars Gullik Bjønnes wrote: > Juergen Vigna <[EMAIL PROTECTED]> writes: > >| as I have to allocate the insets in the Init() function (otherwise the >| above construction of the cellstruct-vector fails as I have 1 inset for >| all table-cells) > > Why? Are you storing pointers to i

Re: Compile error in table.h

2000-05-05 Thread Lars Gullik Bjønnes
Juergen Vigna <[EMAIL PROTECTED]> writes: | as I have to allocate the insets in the Init() function (otherwise the | above construction of the cellstruct-vector fails as I have 1 inset for | all table-cells) Why? Are you storing pointers to insets in the vector(s)? Lgb

Re: Compile error in table.h

2000-05-05 Thread Juergen Vigna
On 04-May-2000 Lars Gullik Bjønnes wrote: >| >| Row and Column Data is now a vector, but can you tell me how I do address >| a stuff like the above? How do I do a v.push_back() for example? > > why do you want a push_back? > > access: vector > table(10, vector(10, > cellstruct(...)); > I did

Re: Compile error in table.h

2000-05-04 Thread Andre Poenitz
> would this work? > array = vector(10, someStruct(someVar)); Why shouldn't it work? Have you tried it? Andre' -- It'll take a long time to eat 63.000 peanuts. André Pönitz . [EMAIL PROTECTED]

Re: Compile error in table.h

2000-05-04 Thread Lars Gullik Bjønnes
Juergen Vigna <[EMAIL PROTECTED]> writes: | On 04-May-2000 Lars Gullik Bjønnes wrote: | > | > a vector > might work, or a Matrix class that build | > upon this. | > | | Row and Column Data is now a vector, but can you tell me how I do address | a stuff like the above? How do I do a v.push_back

Re: Compile error in table.h

2000-05-04 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | André> > Correct code, therefore, is | André> > array = someStruct[10]; | André> > initialise(array); | | André> What about | André>array = vector(10, initial_value); | | would this work? | array = vector(10, someStruct(someVar

Re: Compile error in table.h

2000-05-04 Thread Juergen Vigna
On 04-May-2000 Lars Gullik Bjønnes wrote: > > a vector > might work, or a Matrix class that build > upon this. > Row and Column Data is now a vector, but can you tell me how I do address a stuff like the above? How do I do a v.push_back() for example? Any idea? Jürgen -._-._-._-._-._

Re: Compile error in table.h

2000-05-04 Thread Angus Leeming
André> > Correct code, therefore, is André> >array = someStruct[10]; André> >initialise(array); André> What about André> array = vector(10, initial_value); would this work? array = vector(10, someStruct(someVar)); ie, use a non-default constructor to initialise the vect

Re: Compile error in table.h

2000-05-04 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Lars> | > Correct code, therefore, is | Lars> | > array = someStruct[10]; | Lars> | > initialise(array); | Lars> | > ? | | Lars> | > Angus (living and learning) | | Lars> | Well me too (good living and a bit learning ;) | | Lars> You real

Re: Compile error in table.h

2000-05-04 Thread Angus Leeming
Lars> | > Correct code, therefore, is Lars> | > array = someStruct[10]; Lars> | > initialise(array); Lars> | > ? Lars> | > Angus (living and learning) Lars> | Well me too (good living and a bit learning ;) Lars> You really should get a C++ book... Having a book is one thing. Knowin

Re: Compile error in table.h

2000-05-04 Thread Lars Gullik Bjønnes
Juergen Vigna <[EMAIL PROTECTED]> writes: | > You really should get a C++ book... | > | > Lgb | | I know you told me all the time :), but I have you to ask so why spend | the money ;) (and I hate reading manuals or standarts) I think I will answer this friday. Lgb

Re: Compile error in table.h

2000-05-04 Thread Juergen Vigna
On 04-May-2000 Lars Gullik Bjønnes wrote: > Juergen Vigna <[EMAIL PROTECTED]> writes: > >| On 04-May-2000 Angus Leeming wrote: >| > >| > Correct code, therefore, is >| > array = someStruct[10]; >| > initialise(array); >| > ? >| > >| > Angus (living and learning) >| >| Well me too

Re: Compile error in table.h

2000-05-04 Thread Andre Poenitz
> Aa! So my compiler is correct! I must say though that this is bad design by > the standards commitee, (IMHO of course). > > Correct code, therefore, is > array = someStruct[10]; > initialise(array); > ? What about array = vector(10, initial_value); Andre' -- It'll

Re: Compile error in table.h

2000-05-04 Thread Andre Poenitz
> Why does it work then? Can we use another construct, I'm thinking about > a vector or something like this. I just need a construct where I can insert > elments in the middle too (not just at the end or the beginning). You could use a std::vector. Insertion is O(n) but that definitely does not m

Re: Compile error in table.h

2000-05-04 Thread Lars Gullik Bjønnes
Juergen Vigna <[EMAIL PROTECTED]> writes: | On 04-May-2000 Angus Leeming wrote: | > | > Correct code, therefore, is | > array = someStruct[10]; | > initialise(array); | > ? | > | > Angus (living and learning) | | Well me too (good living and a bit learning ;) You really should get

Re: Compile error in table.h

2000-05-04 Thread Juergen Vigna
On 04-May-2000 Angus Leeming wrote: > > Correct code, therefore, is > array = someStruct[10]; > initialise(array); > ? > > Angus (living and learning) Well me too (good living and a bit learning ;) Jürgen -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-.

Re: Compile error in table.h

2000-05-04 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Lars> | but what I really would like to know is WHY does the constructor not | Lars> | work? | | Lars> You cannot use a constructor on an array allocation. | | Aa! So my compiler is correct! I must say though that this is bad design by | the stand

Re: Compile error in table.h

2000-05-04 Thread Angus Leeming
Lars> | but what I really would like to know is WHY does the constructor not Lars> | work? Lars> You cannot use a constructor on an array allocation. Aa! So my compiler is correct! I must say though that this is bad design by the standards commitee, (IMHO of course). Correct code, therefore

Re: Compile error in table.h

2000-05-04 Thread Lars Gullik Bjønnes
Juergen Vigna <[EMAIL PROTECTED]> writes: | > performs the | > | > if (inset != NULL) ... | > | > internally so it is _never_ needed to do | > | > if (inset) delete inset; | > | > That code construct just shows that you don't know what delete is | > doing. | > | | Well you are right I didn

Re: Compile error in table.h

2000-05-04 Thread Juergen Vigna
> performs the > > if (inset != NULL) ... > > internally so it is _never_ needed to do > > if (inset) delete inset; > > That code construct just shows that you don't know what delete is > doing. > Well you are right I didn't know this :) >| but what I really would like to know is WHY does

Re: Compile error in table.h

2000-05-04 Thread Lars Gullik Bjønnes
Juergen Vigna <[EMAIL PROTECTED]> writes: | >| if (inset) delete inset; | >| inset = new InsetText(buf); This would also casue a segfault if the inset is not set. (0 is ok) | >| } | > | > No, that should be: | > | > void LyXTable::cellstruct::setBuffer(Buffer * buf) | >

Re: Compile error in table.h

2000-05-04 Thread Juergen Vigna
On 04-May-2000 Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > >| Sorry. That should be: >| >| void LyXTable::cellstruct::setBuffer(Buffer * buf) >| { >| if (inset) delete inset; >| inset = new InsetText(buf); >| } > > No, that should be: > > void LyXT

Re: Compile error in table.h

2000-05-04 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Sorry. That should be: | | void LyXTable::cellstruct::setBuffer(Buffer * buf) | { | if (inset) delete inset; | inset = new InsetText(buf); | } No, that should be: void LyXTable::cellstruct::setBuffer(Buffer * buf) {

RE: Compile error in table.h

2000-05-03 Thread Angus Leeming
Jürgen> On 02-May-2000 Angus Leeming wrote: Jürgen> > cxx: Error: table.C, line 235: a new-initializer may not be specified for an array Jürgen> > cell_info[i] = new cellstruct[columns](buffer); Jürgen> I don't understand this. Would it help to have: Jürgen> cellstruct(Buffer * b

Re: Compile error in table.h

2000-05-03 Thread Juergen Vigna
On 02-May-2000 Angus Leeming wrote: > Sorry. That should be: > > void LyXTable::cellstruct::setBuffer(Buffer * buf) > { > if (inset) delete inset; > inset = new InsetText(buf); > } BTW if you change the buffer you loose all text you inserted in the inset, also you init the cellstruc

RE: Compile error in table.h

2000-05-03 Thread Juergen Vigna
On 02-May-2000 Angus Leeming wrote: > I'm trying to get LyX to compile with DEC cxx. Aside from the string::clear() > errors, I get the following error in table.C. Is there a better way of fixing > this than my way? > > Angus (never stop learning) Leeming > > > cxx: Error: table.C, line 235: a

Re: Compile error in table.h

2000-05-02 Thread Andre Poenitz
> I'm trying to get LyX to compile with DEC cxx. Aside from the string::clear() > errors, I get the following error in table.C. Is there a better way of fixing > this than my way? Well, you could try to convince Juergen to rewrite the table stuff using STL containers... Andre' PS: *hint* ;-) -

Re: Compile error in table.h

2000-05-02 Thread Angus Leeming
Sorry. That should be: void LyXTable::cellstruct::setBuffer(Buffer * buf) { if (inset) delete inset; inset = new InsetText(buf); }

Compile error in table.h

2000-05-02 Thread Angus Leeming
I'm trying to get LyX to compile with DEC cxx. Aside from the string::clear() errors, I get the following error in table.C. Is there a better way of fixing this than my way? Angus (never stop learning) Leeming cxx: Error: table.C, line 235: a new-initializer may not be specified for an