Modify

Opened 6 years ago

Closed 5 years ago

#6536 closed Bugs (fixed)

All container constructors should have a variant taking an allocator as a final parameter

Reported by: Erik Jensen <Erik.Jensen@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: container
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:

Description

I am attempting to use the new allocator_traits functionality to facilitate a scoped_pointer work-alike. However, I am running into difficulties because there are a number of constructors that do not have a variant taking an allocator as a final parameter. For example, basic_string does not have a copy-constructor taking an allocator.

Thanks, Erik Jensen

Attachments (0)

Change History (3)

comment:1 Changed 6 years ago by Ion Gaztañaga

Sorry, the scoped allocator model is not implemented yet, let's see if I can find time to bring it in Boost 1.50. Thanks for the ticket.

comment:2 in reply to:  1 Changed 6 years ago by Erik Jensen <Erik.Jensen@…>

Replying to igaztanaga:

Sorry, the scoped allocator model is not implemented yet, let's see if I can find time to bring it in Boost 1.50. Thanks for the ticket.

I know the model itself is not supported, but the new C++11 constructors are useful for more than just that, and it seems like implementation should be pretty simple. For example,

basic_string(const basic_string& s, const allocator_type& a) 
   :  base_t(a)
{ this->priv_range_initialize(s.begin(), s.end()); }

or

vector(const vector &x, const allocator_type &a)
: base_t(a)
{
   this->assign( container_detail::to_raw_pointer(x.members_.m_start)
               , container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size));
}

Of course, there are probably more complications that I am overlooking.

Thanks again for you consideration.

comment:3 Changed 5 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

Fixed in Boost 1.50

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.