Modify

Opened 16 months ago

Closed 14 months ago

Last modified 10 months ago

#12273 closed Feature Requests (fixed)

boost::container::static_vector max_size() and capacity() should be constant expressions

Reported by: jim.king@… Owned by: Ion Gaztañaga
Milestone: Boost 1.62.0 Component: container
Version: Boost 1.61.0 Severity: Optimization
Keywords: Cc:

Description

The capacity of a static_vector is a compile time constant. One should be able to retrieve the capacity at compile time as a constant expression. In the current implementation, one must execute a runtime method of either capacity() or max_size() to obtain the capacity. There are use cases where one would want to create another container that has the same capacity as the static_vector will have, so to improve ease of use I would propose adding:

BOOST_STATIC_CONSTANT(size_type, capacity = Capacity) BOOST_STATIC_CONSTANT(size_type, max_size = Capacity)

following the set of typedefs in the class.

Attachments (0)

Change History (4)

comment:1 Changed 14 months ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

Thanks for the request. Constant "static_capacity" has been added to static_vector/small_vector in commit:

https://github.com/boostorg/container/commit/4122e722a4b43cfcd8a2b29b3cc02209564b2fbf

comment:2 Changed 10 months ago by jking@…

According to the pull request this is in the 1.62 tag - the milestone for this issue needs to be updated to indicate that.

comment:3 Changed 10 months ago by anonymous

Milestone: To Be DeterminedBoost 1.63.0

comment:4 Changed 10 months ago by anonymous

Milestone: Boost 1.63.0Boost 1.62.0

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.