|
Boost : |
Subject: Re: [boost] [container][stable_vector] What does reserve() do for stable_vector
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2015-04-19 05:16:21
El 19/04/2015 a las 10:06, Arindam Mukherjee escribió:
> Consider the following code.
>
> #include <string>
> #include <boost/container/stable_vector.hpp>
> #include <iostream>
>
> int main()
> {
> boost::container::stable_vector<std::string> vec;
> vec.reserve(10);
> std::cout << "capacity = " << vec.capacity() << '\n';
> }
>
> On running this (on g++ and Linux), the output is:
>
> capacity = 4294967286 (that's 2^32 - 10)
>
> If replace boost::container::stable_vector with std::vector above, the
> output is:
It's clearly a bug. The surprising part is that it was introduced a long
time ago.
I just received a a merged a pull request:
https://github.com/boostorg/container/pull/26
Thanks for reporting.
Ion
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk