Opened 11 years ago

Closed 10 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

Change History (3)

comment:1 by Ion Gaztañaga, 11 years ago

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.

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

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 by Ion Gaztañaga, 10 years ago

Resolution: fixed
Status: newclosed

Fixed in Boost 1.50

Note: See TracTickets for help on using tickets.