Modify

Opened 5 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: igaztanaga
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 follow-up: Changed 5 years ago by 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.

comment:2 in reply to: ↑ 1 Changed 5 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 igaztanaga

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in Boost 1.50

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain igaztanaga.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.