|
Boost Users : |
Subject: Re: [Boost-users] [array] with variable size
From: Andy Tompkins (atompkins_at_[hidden])
Date: 2008-11-20 13:31:53
Hi,
On Thu, 20 Nov 2008 17:02:04 -0000, "Hicham Mouline"
<hicham_at_[hidden]> said:
> It doesn't provide a pointer to the internal array that is required by
> my 3rd party lib...?
> while boost::array<> has c_array()....
Actually you can get a pointer to the internal array.
void f(double *pArray);
std::vector<double> v;
if (!v.empty()) {
f(&v[0]);
}
>
> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Steven Watanabe
> Sent: 20 November 2008 16:12
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [array] with variable size
>
> AMDG
>
> Hicham Mouline wrote:
> > I have a third-party library that gives me a number N of doubles,
> > then expects from me a double* to an array where it will set N elements
> >
> > This would have happen many times and N is variable,
> > so I wish not to reallocate the array each time.
> >
>
> Can't you use a vector and resize it every time?
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Regards,
Andy.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net