New to Boost C++ - Dynamic Arrays

Hello,

I am interested in supporting dynamic arrays in my C++ application. I
read about STL, which somehow brought me to Boost C++...

I see Boost C++ provides the Array library, which only seems to
support static arrays... Does Boost C++ support dynamic arrays? Any
example I could use to understand how this work?
By any means, would this dynamic array library be thread safe?

Thanks!
Jean
Maik Beckmann | 4 Jul 22:33

Re: New to Boost C++ - Dynamic Arrays

Am Freitag 04 Juli 2008 18:59:20 schrieb Jean-Sebastien Stoezel:
> Hello,
>
> I am interested in supporting dynamic arrays in my C++ application. I
> read about STL, which somehow brought me to Boost C++...
>
> I see Boost C++ provides the Array library, which only seems to
> support static arrays... Does Boost C++ support dynamic arrays? Any
> example I could use to understand how this work?
> By any means, would this dynamic array library be thread safe?
>
> Thanks!
> Jean

A dynamic array is part of the stl and called vector
  http://cppreference.com/cppvector/index.html
  http://www.cplusplus.com/reference/stl/vector

It isn't thread safe out of the box, but boost gives you what you need to make 
access mutual exclusive
  http://www.boost.org/doc/libs/1_35_0/doc/html/thread.html
in a portable way (POSIX, Windows,...)

Best,
 -- Maik
David Abrahams | 4 Jul 22:35
Favicon
Gravatar

Re: New to Boost C++ - Dynamic Arrays


on Fri Jul 04 2008, "Jean-Sebastien Stoezel" <js.stoezel-AT-gmail.com> wrote:

> Hello,
>
> I am interested in supporting dynamic arrays in my C++ application. I
> read about STL, which somehow brought me to Boost C++...
>
> I see Boost C++ provides the Array library, which only seems to
> support static arrays... Does Boost C++ support dynamic arrays? 

Have you considered std::vector?

--

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com
Boris | 6 Jul 18:35

Re: New to Boost C++ - Dynamic Arrays

On Fri, 04 Jul 2008 18:59:20 +0200, Jean-Sebastien Stoezel  
<js.stoezel <at> gmail.com> wrote:

> Hello,
>
> I am interested in supporting dynamic arrays in my C++ application. I
> read about STL, which somehow brought me to Boost C++...
>
> I see Boost C++ provides the Array library, which only seems to
> support static arrays... Does Boost C++ support dynamic arrays? Any
> example I could use to understand how this work?

I created a constant array whose size can be set at runtime a few years  
ago. I just uploaded it to the vault - see  
http://www.boostpro.com/vault/index.php?action=downloadfile&filename=boost_carray.zip

Boris

Gmane