toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Toon-members] Re: STL containers with TooN


From: Gerhard Reitmayr
Subject: Re: [Toon-members] Re: STL containers with TooN
Date: Wed, 13 Jan 2010 11:04:02 +0100

> 
> just from reading docs, one needs default, copy constructors and assignment 
> to work. that makes sense for example with the following code:
> 
> vector<Vector<Dynamic> > v(10); // 10 dynamic vectors
> v[0] = Vector<Dynamic>(10);     // set first to a vector with 10 els
> v[1] = Vector<Dynamic>(20);     // set second to a vector with 20 els
> 
> Resizable makes sense, i guess that assignment on a Resizable should always 
> work (and resize as necessary)
> 
> For Dynamic, how about making it stateful and have the default constructor 
> set a sentinel that allows it to be resized with the first assignment ? (and 
> assert, if it is assigned from another Dynamic in the same state )? a copy 
> constructor or explicit size constructor will not allow further resizing, 
> similarly after the first resize. that way the code above would work and one 
> would still have the same runtime safety...
> 


just got bitten again by the missing default constructor for Vector<Dynamic>. 
How about the above suggestion ? this we could have them default constructed 
and fixed on first assignment ?

cheers,
  Gerhard

> cheers,
>  Gerhard
> 
>> Thoughts, anyone?
>> 
>> -Ed
>> 
>> 
>> 
>>> Thanks!
>>> 
>>> Am 10.01.2010 um 21:37 schrieb Gabriel Nützi:
>>> 
>>>> Hello again
>>>> Sorry for my questions, but I am using TooN permanently, with all its 
>>>> advantages... (LU,SymEigen....)
>>>> I was wondering, because I need a container which is as fallowing
>>>> list < Vector<Dynamic,double> >   myList;
>>>> Why does it give RunTime problems and segmentation errors when I try to 
>>>> use the list by inserting and deleting Vectors, it happens also when the 
>>>> Vector is not dynamic ...
>>>> Is there any troubles with the containers and TooN?
>>>> This crashed in Runtime:
>>>> //===================================
>>>> list < Vector<Dynamic,double> >   myList;
>>>> myList.push_back( makeVector (1,1,1) );
>>>> myList.push_back( makeVector (2,1,1) );
>>>> myList.push_back( makeVector (3,1,1) );
>>>> list < Vector<Dynamic,double> > ::iterator it;
>>>> it = myList.begin();
>>>> it++;
>>>> myList.erase(it);
>>>> //=================================
>>>> Thanks a lot
>>>> Gabriel!
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Toon-members mailing list
>>> address@hidden
>>> http://lists.nongnu.org/mailman/listinfo/toon-members
>> 
>> -- 
>> (You can't go wrong with psycho-rats.)(http://mi.eng.cam.ac.uk/~er258)
>> 
>> /d{def}def/f{/Times s selectfont}d/s{11}d/r{roll}d f 2/m{moveto}d -1
>> r 230 350 m 0 1 179{ 1 index show 88 rotate 4 mul 0 rmoveto}for/s 12
>>   d f pop 235 420 translate 0 0 moveto 1 2 scale show 
>> showpage_______________________________________________
>> Toon-members mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/toon-members
> 

--
Gerhard Reitmayr
Institute for Computer Graphics and Vision
http://www.icg.tugraz.at/Members/gerhard
tel: ++43 316 873 5082







reply via email to

[Prev in Thread] Current Thread [Next in Thread]