Date: Wed, 8 Mar 2000 09:59:12 +0200 (WET) From: Andris Pavenis To: Robin Johnson cc: djgpp AT delorie DOT com Subject: Re: convert STL vector to *int In-Reply-To: <38C52111.D5C5C3EE@home.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: dj-admin AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Tue, 7 Mar 2000, Robin Johnson wrote: > Hi, > > I need some help trying to convert all the elements of an STL vector array > to an *int array, for use with the Allegro polygon function. > I am currently using libgpp for the STL. I had some code that worked with TC and > most real mode compilers, using a few assembler shortcuts that of course don't > work in protected mode. Anybody willing to lend a hand? > > source: vector v_list; > dest: *int p_list; > Simple example: #include #include #include template T * to_array (vector & from) { T * ret = new T [from.size()]; copy (from.begin(), frome.end(), ret); return ret; } Don't forget to free returned array after use.