![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | use array or vector Fernando Gómez wrote: Quote: > Daniel wrote: Quote: >> Why use that instead of ArrayList? >> >> Daniel >> >> "Ben Voigt [C++ MVP]" <rbv@xxxxxx> wrote in message >> news:uY9UG345IHA.1176@xxxxxx Quote: >>> Fernando Gómez wrote: >>>> Daniel wrote: >>>>> I wanted to use an object from the newer .NET namespace. >>>>> >>>>> Daniel >>>>> >>>> Then you could use System::Collection::ArrayList. >>> Don't use ArrayList in new code. >>> >>> Use ::System::Collections::Generic::List<T> instead, with an >>> appropriate value for T. >>> >>>> Regards. >>> >> > to cast from object to you your particular type, etc. doesn't require boxing and unboxing operations, inlines better, etc. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: use array or vector Daniel wrote: Quote: > I need to use arrays that I can dimension during runtime. Is there a way to > do that in VC++ .NET using arrays, or would I need to use vectors instead? If this is a question about standard C++, you should have asked it in microsoft.public.vc.language. And the answer would have been: use std::vector. -- David Wilkinson Visual C++ MVP |
My System Specs![]() |
| | #3 (permalink) |
| | Re: use array or vector David Wilkinson wrote: Quote: > Daniel wrote: Quote: >> I need to use arrays that I can dimension during runtime. Is there a >> way to do that in VC++ .NET using arrays, or would I need to use >> vectors instead? > Daniel: > > If this is a question about standard C++, you should have asked it in > microsoft.public.vc.language. > > And the answer would have been: use std::vector. > using). Or something from System::Collections. Regards. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: use array or vector What does OP stand for? Daniel "Fernando Gómez" <fernando.a.gomez.f@xxxxxx> wrote in message news:OnRJRE25IHA.1468@xxxxxx Quote: > David Wilkinson wrote: Quote: >> Daniel wrote: Quote: >>> I need to use arrays that I can dimension during runtime. Is there a >>> way to do that in VC++ .NET using arrays, or would I need to use vectors >>> instead? >> Daniel: >> >> If this is a question about standard C++, you should have asked it in >> microsoft.public.vc.language. >> >> And the answer would have been: use std::vector. >> > Or perhaps CArray (well, the OP didn't specify the library he was using). > Or something from System::Collections. > > Regards. > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: use array or vector I wanted to use an object from the newer .NET namespace. Daniel "David Wilkinson" <no-reply@xxxxxx> wrote in message news:us7eBt15IHA.3480@xxxxxx Quote: > Daniel wrote: Quote: >> I need to use arrays that I can dimension during runtime. Is there a way >> to do that in VC++ .NET using arrays, or would I need to use vectors >> instead? > Daniel: > > If this is a question about standard C++, you should have asked it in > microsoft.public.vc.language. > > And the answer would have been: use std::vector. > > -- > David Wilkinson > Visual C++ MVP |
My System Specs![]() |
| | #6 (permalink) |
| | Re: use array or vector If I use std::vector, would my code still be portable to other .NET runtimes on top of other platforms? Daniel "David Wilkinson" <no-reply@xxxxxx> wrote in message news:us7eBt15IHA.3480@xxxxxx Quote: > Daniel wrote: Quote: >> I need to use arrays that I can dimension during runtime. Is there a way >> to do that in VC++ .NET using arrays, or would I need to use vectors >> instead? > Daniel: > > If this is a question about standard C++, you should have asked it in > microsoft.public.vc.language. > > And the answer would have been: use std::vector. > > -- > David Wilkinson > Visual C++ MVP |
My System Specs![]() |
| | #7 (permalink) |
| | Re: use array or vector Daniel wrote: Quote: > What does OP stand for? > > Daniel |
My System Specs![]() |
| | #8 (permalink) |
| | Re: use array or vector Daniel wrote: Quote: > I wanted to use an object from the newer .NET namespace. > > Daniel > Regards. |
My System Specs![]() |
| | #9 (permalink) |
| | Re: use array or vector Fernando Gómez wrote: Quote: > Daniel wrote: Quote: >> I wanted to use an object from the newer .NET namespace. >> >> Daniel >> > Then you could use System::Collection::ArrayList. Use ::System::Collections::Generic::List<T> instead, with an appropriate value for T. Quote: > > Regards. |
My System Specs![]() |
| | #10 (permalink) |
| | Re: use array or vector Daniel wrote: Quote: > If I use std::vector, would my code still be portable to other .NET > runtimes on top of other platforms? (1) You are using VC2005 or newer (2) You pass /clr ure, which disallows a lot of native stuff. Whetherstd::vector still works I can't say, it may even depend on the type you are using it with. Quote: > > Daniel > > "David Wilkinson" <no-reply@xxxxxx> wrote in message > news:us7eBt15IHA.3480@xxxxxx Quote: >> Daniel wrote: Quote: >>> I need to use arrays that I can dimension during runtime. Is there >>> a way to do that in VC++ .NET using arrays, or would I need to use >>> vectors instead? >> Daniel: >> >> If this is a question about standard C++, you should have asked it in >> microsoft.public.vc.language. >> >> And the answer would have been: use std::vector. >> >> -- >> David Wilkinson >> Visual C++ MVP |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Fast copy method of sub array (=array range) possible? | VB Script | |||
| Stupid Array Tricks: Initializing an Array to a Certain Size | PowerShell | |||
| True Vector | Vista performance & maintenance | |||
| how to assign values to array and how to create array via variable | PowerShell | |||