[Container] Does deque allocate memory in default constructor?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Container] Does deque allocate memory in default constructor?

Boost - Users mailing list
It seems std::deque implementations are allowed to allocate in the default constructor [1]

However, boost::container::deque I think does not allocate in the default constructor, but the docs are not explicit about it.

I can see in the docs:
Throws: If allocator_type's default constructor throws.

Which would mean that it cannot throw due to memory exhaustion, so it cannot allocate memory.

Is my reasoning right?

If yes, would it be possible to make this explicit in the docs?
I think it is relevant, because it might be the deciding factor for switching from std::deque to boost::container::deque (as it might be my case).

Thanks!



_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Container] Does deque allocate memory in default constructor?

Boost - Users mailing list
On 25/10/2017 17:17, dariomt--- via Boost-users wrote:
> It seems std::deque implementations are allowed to allocate in the
> default constructor [1]
>
> However, boost::container::deque I think does not allocate in the
> default constructor, but the docs are not explicit about it.
>
> I can see in the docs:
> *Throws*: If allocator_type's default constructor throws.

Isn't that explicit enough?

> Which would mean that it cannot throw due to memory exhaustion, so it
> cannot allocate memory.
>
> Is my reasoning right?

Yes. All Boost.Container containers don't allocate in the default
constructor.

> If yes, would it be possible to make this explicit in the docs?
> I think it is relevant, because it might be the deciding factor for
> switching from std::deque to boost::container::deque (as it might be my
> case).

Please open a issue so that this is not forgotten.

Best,

Ion
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users