Re: Question for our STL experts!

2002-01-07 Thread Andre Poenitz
On Tue, Jan 08, 2002 at 12:16:56AM +0100, Lars Gullik Bjønnes wrote: > Now read about pair a_eq.insert(t). > And then read about [] again in 23.3.1.2. Indeed, I missed that. I stand corrected. Andre' -- André Pönitz .. [EMAIL PROTECTED]

Re: Question for our STL experts!

2002-01-07 Thread Andre Poenitz
On Mon, Jan 07, 2002 at 05:41:11PM +0100, Lars Gullik Bjønnes wrote: > AFAIK insert will not insert a new key if it already exists. (only > for map and set of course) >From CD2: 23.1.2 Associative containers[lib.associative.reqmts] ---

Re: Question for our STL experts!

2002-01-07 Thread Andre Poenitz
On Mon, Jan 07, 2002 at 04:44:23PM +0100, Juergen Vigna wrote: > > 'insert' creates a new entry or overwrite an ol;d entry with the same key, > > exactly what operator[]() would do. > > Well it seems it does not at least not in the implementation that I use! I don't believe you. Try again... ;-)

Re: Question for our STL experts!

2002-01-07 Thread Juergen Vigna
On 07-Jan-2002 Andre Poenitz wrote: > There is no way to have multiple entries for the same key in a std::map. > One would have to use a std::multimap if that feature was needed. > > 'insert' creates a new entry or overwrite an ol;d entry with the same key, > exactly what operator[]() would do.

Re: Question for our STL experts!

2002-01-07 Thread Juergen Vigna
On 07-Jan-2002 Lars Gullik Bjønnes wrote: > but I'd also say that it is an error trying to store a bufferview in > the cache when it is already there. F.ex. the TextCache requires that > the BufferView stored therein is _not_ viewed in any LyXView. > > I think that the cache in insettext very w

Re: Question for our STL experts!

2002-01-07 Thread Juergen Vigna
On 07-Jan-2002 Lars Gullik Bjønnes wrote: > I am pretty sure you did it... > (at least I am quite sure that I didn't, I only did the BufferView > TextCache.) Well anyway it has to be fixed so I would need an experts council what I should do, I would do this: -cache.insert(make_pair(bv,

Re: Question for our STL experts!

2002-01-07 Thread Juergen Vigna
On 07-Jan-2002 Lars Gullik Bjønnes wrote: > map translate; > > translate["Hei"] = "Hello"; > > translate.insert(make_pair("Hei", "Hi")); > > then the insert will not work since "Hei" is already set. So in this case we should never use insert but always the assignment operator? Jug

Re: Question for our STL experts!

2002-01-07 Thread Juergen Vigna
On 07-Jan-2002 Lars Gullik Bjønnes wrote: > The BufferView in actual use should _never_ be in the cache. So when > you search in the cach for a BufferView and find the one you want to > use, it should also be removed from the cache. Care to explain? I don't think I did that part of the code som

RE: Question for our STL experts!

2002-01-07 Thread Juergen Vigna
On 07-Jan-2002 Juergen Vigna wrote: > I ask this because it seems to me that it does only insert a new item > but does not substitute the other one and then when searching for the > LyXText of this BufferView we have multiple choices. Well it really seems it does not! This could be a reason for