"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
> 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
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?
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
> 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
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
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
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
> 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]
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
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
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
-._-._-._-._-._
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
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
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
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
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
> 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
> 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
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
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
-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-.
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
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
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
> 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
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)
| >
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
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)
{
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
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
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
> 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* ;-)
-
Sorry. That should be:
void LyXTable::cellstruct::setBuffer(Buffer * buf)
{
if (inset) delete inset;
inset = new InsetText(buf);
}
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
34 matches
Mail list logo