<s>
In	O
C++	B-Language
computer	B-General_Concept
programming	I-General_Concept
,	O
allocators	B-Application
are	O
a	O
component	O
of	O
the	O
C++	B-Language
Standard	I-Language
Library	I-Language
.	O
</s>
<s>
The	O
standard	O
library	B-Library
provides	O
several	O
data	B-General_Concept
structures	I-General_Concept
,	O
such	O
as	O
list	O
and	O
set	O
,	O
commonly	O
referred	O
to	O
as	O
containers	B-Application
.	O
</s>
<s>
A	O
common	O
trait	O
among	O
these	O
containers	B-Application
is	O
their	O
ability	O
to	O
change	O
size	O
during	O
the	O
execution	B-Library
of	O
the	O
program	B-Application
.	O
</s>
<s>
To	O
achieve	O
this	O
,	O
some	O
form	O
of	O
dynamic	B-General_Concept
memory	I-General_Concept
allocation	I-General_Concept
is	O
usually	O
required	O
.	O
</s>
<s>
Allocators	B-Application
handle	O
all	O
the	O
requests	O
for	O
allocation	B-Application
and	I-Application
deallocation	I-Application
of	O
memory	O
for	O
a	O
given	O
container	B-Application
.	O
</s>
<s>
The	O
C++	B-Language
Standard	I-Language
Library	I-Language
provides	O
general-purpose	O
allocators	B-Application
that	O
are	O
used	O
by	O
default	O
,	O
however	O
,	O
custom	O
allocators	B-Application
may	O
also	O
be	O
supplied	O
by	O
the	O
programmer	B-Application
.	O
</s>
<s>
Allocators	B-Application
were	O
invented	O
by	O
Alexander	O
Stepanov	O
as	O
part	O
of	O
the	O
Standard	B-Application
Template	I-Application
Library	I-Application
(	O
STL	B-Application
)	O
.	O
</s>
<s>
They	O
were	O
originally	O
intended	O
as	O
a	O
means	O
to	O
make	O
the	O
library	B-Library
more	O
flexible	O
and	O
independent	O
of	O
the	O
underlying	O
memory	B-Device
model	I-Device
,	O
allowing	O
programmers	B-Application
to	O
utilize	O
custom	O
pointer	O
and	O
reference	B-Language
types	I-Language
with	O
the	O
library	B-Library
.	O
</s>
<s>
However	O
,	O
in	O
the	O
process	O
of	O
adopting	O
STL	B-Application
into	O
the	O
C++	B-Language
standard	O
,	O
the	O
C++	B-Language
standardization	O
committee	O
realized	O
that	O
a	O
complete	O
abstraction	B-Application
of	O
the	O
memory	B-Device
model	I-Device
would	O
incur	O
unacceptable	O
performance	O
penalties	O
.	O
</s>
<s>
To	O
remedy	O
this	O
,	O
the	O
requirements	O
of	O
allocators	B-Application
were	O
made	O
more	O
restrictive	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
the	O
level	O
of	O
customization	O
provided	O
by	O
allocators	B-Application
is	O
more	O
limited	O
than	O
was	O
originally	O
envisioned	O
by	O
Stepanov	O
.	O
</s>
<s>
Nevertheless	O
,	O
there	O
are	O
many	O
scenarios	O
where	O
customized	O
allocators	B-Application
are	O
desirable	O
.	O
</s>
<s>
Some	O
of	O
the	O
most	O
common	O
reasons	O
for	O
writing	O
custom	O
allocators	B-Application
include	O
improving	O
performance	O
of	O
allocations	O
by	O
using	O
memory	B-General_Concept
pools	I-General_Concept
,	O
and	O
encapsulating	O
access	O
to	O
different	O
types	O
of	O
memory	O
,	O
like	O
shared	B-Operating_System
memory	I-Operating_System
or	O
garbage-collected	B-General_Concept
memory	O
.	O
</s>
<s>
In	O
particular	O
,	O
programs	O
with	O
many	O
frequent	O
allocations	O
of	O
small	O
amounts	O
of	O
memory	O
may	O
benefit	O
greatly	O
from	O
specialized	O
allocators	B-Application
,	O
both	O
in	O
terms	O
of	O
running	O
time	O
and	O
memory	O
footprint	O
.	O
</s>
<s>
Alexander	O
Stepanov	O
and	O
Meng	O
Lee	O
presented	O
the	O
Standard	B-Application
Template	I-Application
Library	I-Application
to	O
the	O
C++	B-Language
standards	O
committee	O
in	O
March	O
1994	O
.	O
</s>
<s>
The	O
library	B-Library
received	O
preliminary	O
approval	O
,	O
although	O
a	O
few	O
issues	O
were	O
raised	O
.	O
</s>
<s>
In	O
particular	O
,	O
Stepanov	O
was	O
requested	O
to	O
make	O
the	O
library	B-Library
containers	B-Application
independent	O
of	O
the	O
underlying	O
memory	B-Device
model	I-Device
,	O
which	O
led	O
to	O
the	O
creation	O
of	O
allocators	B-Application
.	O
</s>
<s>
Consequently	O
,	O
all	O
of	O
the	O
STL	B-Application
container	B-Application
interfaces	O
had	O
to	O
be	O
rewritten	O
to	O
accept	O
allocators	B-Application
.	O
</s>
<s>
In	O
adapting	O
STL	B-Application
to	O
be	O
included	O
in	O
the	O
C++	B-Language
Standard	I-Language
Library	I-Language
,	O
Stepanov	O
worked	O
closely	O
with	O
several	O
members	O
of	O
the	O
standards	O
committee	O
,	O
including	O
Andrew	O
Koenig	O
and	O
Bjarne	O
Stroustrup	O
,	O
who	O
observed	O
that	O
custom	O
allocators	B-Application
could	O
potentially	O
be	O
used	O
to	O
implement	O
persistent	B-Application
storage	I-Application
STL	B-Application
containers	B-Application
,	O
which	O
Stepanov	O
at	O
the	O
time	O
considered	O
an	O
"	O
important	O
and	O
interesting	O
insight	O
"	O
.	O
</s>
<s>
From	O
the	O
point	O
of	O
view	O
of	O
portability	B-Architecture
,	O
all	O
the	O
machine-specific	O
things	O
which	O
relate	O
to	O
the	O
notion	O
of	O
address	O
,	O
pointer	O
,	O
and	O
so	O
on	O
,	O
are	O
encapsulated	O
within	O
a	O
tiny	O
,	O
well-understood	O
mechanism	O
.	O
</s>
<s>
The	O
original	O
allocator	B-Application
proposal	O
incorporated	O
some	O
language	O
features	O
that	O
had	O
not	O
yet	O
been	O
accepted	O
by	O
the	O
committee	O
,	O
namely	O
the	O
ability	O
to	O
use	O
template	B-Application
arguments	I-Application
that	O
are	O
themselves	O
templates	B-Application
.	O
</s>
<s>
Since	O
these	O
features	O
could	O
not	O
be	O
compiled	B-Language
by	O
any	O
existing	O
compiler	B-Language
,	O
there	O
was	O
,	O
according	O
to	O
Stepanov	O
,	O
"	O
an	O
enormous	O
demand	O
on	O
Bjarne	O
[Stroustrup]'s	O
and	O
Andy	O
[Koenig]'s	O
time	O
trying	O
to	O
verify	O
that	O
we	O
were	O
using	O
these	O
non-implemented	O
features	O
correctly.	O
"	O
</s>
<s>
Where	O
the	O
library	B-Library
had	O
previously	O
used	O
pointer	O
and	O
reference	B-Language
types	I-Language
directly	O
,	O
it	O
would	O
now	O
only	O
refer	O
to	O
the	O
types	O
defined	O
by	O
the	O
allocator	B-Application
.	O
</s>
<s>
Stepanov	O
later	O
described	O
allocators	B-Application
as	O
follows	O
:	O
"	O
A	O
nice	O
feature	O
of	O
STL	B-Application
is	O
that	O
the	O
only	O
place	O
that	O
mentions	O
the	O
machine-related	O
types	O
(	O
...	O
)	O
is	O
encapsulated	O
within	O
roughly	O
16	O
lines	O
of	O
code.	O
"	O
</s>
<s>
While	O
Stepanov	O
had	O
originally	O
intended	O
allocators	B-Application
to	O
completely	O
encapsulate	O
the	O
memory	B-Device
model	I-Device
,	O
the	O
standards	O
committee	O
realized	O
that	O
this	O
approach	O
would	O
lead	O
to	O
unacceptable	O
efficiency	O
degradations	O
.	O
</s>
<s>
To	O
remedy	O
this	O
,	O
additional	O
wording	O
was	O
added	O
to	O
the	O
allocator	B-Application
requirements	O
.	O
</s>
<s>
In	O
particular	O
,	O
container	B-Application
implementations	O
may	O
assume	O
that	O
the	O
allocator	B-Application
's	O
type	B-Language
definitions	I-Language
for	O
pointers	O
and	O
related	O
integral	O
types	O
are	O
equivalent	O
to	O
those	O
provided	O
by	O
the	O
default	O
allocator	B-Application
,	O
and	O
that	O
all	O
instances	O
of	O
a	O
given	O
allocator	B-Application
type	O
always	O
compare	O
equal	O
,	O
effectively	O
contradicting	O
the	O
original	O
design	O
goals	O
for	O
allocators	B-Application
and	O
limiting	O
the	O
usefulness	O
of	O
allocators	B-Application
that	O
carry	O
state	O
.	O
</s>
<s>
Stepanov	O
later	O
commented	O
that	O
,	O
while	O
allocators	B-Application
"	O
are	O
not	O
such	O
a	O
bad	O
 [ idea ] 	O
in	O
theory	O
(	O
...	O
)	O
[u]nfortunately	O
they	O
cannot	O
work	O
in	O
practice	O
"	O
.	O
</s>
<s>
He	O
observed	O
that	O
to	O
make	O
allocators	B-Application
really	O
useful	O
,	O
a	O
change	O
to	O
the	O
core	O
language	O
with	O
regards	O
to	O
references	O
was	O
necessary	O
.	O
</s>
<s>
The	O
2011	B-Language
revision	I-Language
of	I-Language
the	I-Language
C++	I-Language
Standard	I-Language
removed	O
the	O
weasel	O
words	O
requiring	O
that	O
allocators	B-Application
of	O
a	O
given	O
type	O
always	O
compare	O
equal	O
and	O
use	O
normal	O
pointers	O
.	O
</s>
<s>
These	O
changes	O
make	O
stateful	O
allocators	B-Application
much	O
more	O
useful	O
and	O
allow	O
allocators	B-Application
to	O
manage	O
out-of-process	O
shared	B-Operating_System
memory	I-Operating_System
.	O
</s>
<s>
The	O
current	O
purpose	O
of	O
allocators	B-Application
is	O
to	O
give	O
the	O
programmer	B-Application
control	O
over	O
memory	B-General_Concept
allocation	I-General_Concept
within	O
containers	B-Application
,	O
rather	O
than	O
to	O
adapt	O
the	O
address	O
model	O
of	O
the	O
underlying	O
hardware	O
.	O
</s>
<s>
In	O
fact	O
,	O
the	O
revised	O
standard	O
eliminated	O
the	O
ability	O
of	O
allocators	B-Application
to	O
represent	O
extensions	O
to	O
the	O
C++	B-Language
address	O
model	O
,	O
formally	O
(	O
and	O
deliberately	O
)	O
eliminating	O
their	O
original	O
purpose	O
.	O
</s>
<s>
Any	O
class	B-Application
that	O
fulfills	O
the	O
allocator	B-Application
requirements	O
can	O
be	O
used	O
as	O
an	O
allocator	B-Application
.	O
</s>
<s>
In	O
particular	O
,	O
a	O
class	B-Application
A	O
capable	O
of	O
allocating	O
memory	O
for	O
an	O
object	O
of	O
type	O
T	O
must	O
provide	O
the	O
types	O
A::pointer	O
,	O
A::const_pointer	O
,	O
A::reference	O
,	O
A::const_reference	O
,	O
and	O
A::value_type	O
for	O
generically	O
declaring	O
objects	O
and	O
references	O
(	O
or	O
pointers	O
)	O
to	O
objects	O
of	O
type	O
T	O
.	O
It	O
should	O
also	O
provide	O
type	O
A::size_type	O
,	O
an	O
unsigned	O
type	O
which	O
can	O
represent	O
the	O
largest	O
size	O
for	O
an	O
object	O
in	O
the	O
allocation	O
model	O
defined	O
by	O
A	O
,	O
and	O
similarly	O
,	O
a	O
signed	O
integral	O
A::difference_type	O
that	O
can	O
represent	O
the	O
difference	O
between	O
any	O
two	O
pointers	O
in	O
the	O
allocation	O
model	O
.	O
</s>
<s>
Although	O
a	O
conforming	O
standard	O
library	B-Library
implementation	O
is	O
allowed	O
to	O
assume	O
that	O
the	O
allocator	B-Application
's	O
A::pointer	O
and	O
A::const_pointer	O
are	O
simply	O
typedefs	B-Language
for	O
T*	O
and	O
T	O
const*	O
,	O
library	B-Library
implementors	O
are	O
encouraged	O
to	O
support	O
more	O
general	O
allocators	B-Application
.	O
</s>
<s>
An	O
allocator	B-Application
,	O
A	O
,	O
for	O
objects	O
of	O
type	O
T	O
must	O
have	O
a	O
member	O
function	O
with	O
the	O
signature	O
.	O
</s>
<s>
Moreover	O
,	O
an	O
optional	O
pointer	O
argument	O
(	O
that	O
points	O
to	O
an	O
object	O
already	O
allocated	O
by	O
A	O
)	O
can	O
be	O
used	O
as	O
a	O
hint	O
to	O
the	O
implementation	O
about	O
where	O
the	O
new	O
memory	O
should	O
be	O
allocated	O
in	O
order	O
to	O
improve	O
locality	B-General_Concept
.	O
</s>
<s>
The	O
A::max_size( )	O
member	O
function	O
returns	O
the	O
largest	O
number	O
of	O
objects	O
of	O
type	O
T	O
that	O
could	O
be	O
expected	O
to	O
be	O
successfully	O
allocated	O
by	O
an	O
invocation	O
of	O
A::allocate	O
;	O
the	O
value	O
returned	O
is	O
typically	O
A::size_type(-1 )	O
/	O
sizeof(T )	O
.	O
</s>
<s>
Also	O
,	O
the	O
A::address	O
member	O
function	O
returns	O
an	O
A::pointer	O
denoting	O
the	O
address	O
of	O
an	O
object	O
,	O
given	O
an	O
A::reference	O
.	O
</s>
<s>
Object	O
construction	O
and	O
destruction	O
is	O
performed	O
separately	O
from	O
allocation	B-Application
and	I-Application
deallocation	I-Application
.	O
</s>
<s>
The	O
allocator	B-Application
is	O
required	O
to	O
have	O
two	O
member	O
functions	O
,	O
A::construct	O
and	O
A::destroy	O
(	O
both	O
functions	O
have	O
been	O
deprecated	O
in	O
C++17	O
,	O
and	O
removed	O
in	O
C++20	O
)	O
,	O
which	O
handles	O
object	O
construction	O
and	O
destruction	O
,	O
respectively	O
.	O
</s>
<s>
The	O
above	O
code	O
uses	O
the	O
placement	B-Language
new	I-Language
syntax	O
,	O
and	O
calls	O
the	O
destructor	B-Language
directly	O
.	O
</s>
<s>
Allocators	B-Application
should	O
be	O
copy-constructible	B-Language
.	O
</s>
<s>
An	O
allocator	B-Application
for	O
objects	O
of	O
type	O
T	O
can	O
be	O
constructed	O
from	O
an	O
allocator	B-Application
for	O
objects	O
of	O
type	O
U	O
.	O
</s>
<s>
If	O
an	O
allocator	B-Application
,	O
A	O
,	O
allocates	O
a	O
region	O
of	O
memory	O
,	O
R	O
,	O
then	O
R	O
can	O
only	O
be	O
deallocated	O
by	O
an	O
allocator	B-Application
that	O
compares	O
equal	O
to	O
A	O
.	O
</s>
<s>
Allocators	B-Application
are	O
required	O
to	O
supply	O
a	O
template	B-Application
class	B-Application
member	O
template	B-Application
<typename U> struct A::rebind { typedef A<U>	O
other	O
;	O
};	O
,	O
which	O
enables	O
the	O
possibility	O
of	O
obtaining	O
a	O
related	O
allocator	B-Application
,	O
parameterized	B-Application
in	O
terms	O
of	O
a	O
different	O
type	O
.	O
</s>
<s>
For	O
example	O
,	O
given	O
an	O
allocator	B-Application
type	O
IntAllocator	O
for	O
objects	O
of	O
type	O
int	O
,	O
a	O
related	O
allocator	B-Application
type	O
for	O
objects	O
of	O
type	O
long	O
could	O
be	O
obtained	O
using	O
IntAllocator::rebindxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1::other	O
.	O
</s>
<s>
One	O
of	O
the	O
main	O
reasons	O
for	O
writing	O
a	O
custom	O
allocator	B-Application
is	O
performance	O
.	O
</s>
<s>
Utilizing	O
a	O
specialized	O
custom	O
allocator	B-Application
may	O
substantially	O
improve	O
the	O
performance	O
or	O
memory	B-General_Concept
usage	I-General_Concept
,	O
or	O
both	O
,	O
of	O
the	O
program	B-Application
.	O
</s>
<s>
The	O
default	O
allocator	B-Application
uses	O
operator	B-Language
new	I-Language
to	O
allocate	O
memory	O
.	O
</s>
<s>
This	O
is	O
often	O
implemented	O
as	O
a	O
thin	O
layer	O
around	O
the	O
C	B-Language
heap	B-Application
allocation	I-Application
functions	O
,	O
which	O
are	O
usually	O
optimized	O
for	O
infrequent	O
allocation	O
of	O
large	O
memory	O
blocks	O
.	O
</s>
<s>
This	O
approach	O
may	O
work	O
well	O
with	O
containers	B-Application
that	O
mostly	O
allocate	O
large	O
chunks	O
of	O
memory	O
,	O
like	O
vector	O
and	O
deque	B-Application
.	O
</s>
<s>
However	O
,	O
for	O
containers	B-Application
that	O
require	O
frequent	O
allocations	O
of	O
small	O
objects	O
,	O
such	O
as	O
map	B-Language
and	O
list	O
,	O
using	O
the	O
default	O
allocator	B-Application
is	O
generally	O
slow	O
.	O
</s>
<s>
Other	O
common	O
problems	O
with	O
a	O
malloc-based	O
allocator	B-Application
include	O
poor	O
locality	B-General_Concept
of	I-General_Concept
reference	I-General_Concept
,	O
and	O
excessive	O
memory	B-Architecture
fragmentation	I-Architecture
.	O
</s>
<s>
A	O
popular	O
approach	O
to	O
improve	O
performance	O
is	O
to	O
create	O
a	O
memory	O
pool-based	O
allocator	B-Application
.	O
</s>
<s>
Instead	O
of	O
allocating	O
memory	O
every	O
time	O
an	O
item	O
is	O
inserted	O
or	O
removed	O
from	O
a	O
container	B-Application
,	O
a	O
large	O
block	O
of	O
memory	O
(	O
the	O
memory	B-General_Concept
pool	I-General_Concept
)	O
is	O
allocated	O
beforehand	O
,	O
possibly	O
at	O
the	O
startup	O
of	O
the	O
program	B-Application
.	O
</s>
<s>
The	O
custom	O
allocator	B-Application
will	O
serve	O
individual	O
allocation	O
requests	O
by	O
simply	O
returning	O
a	O
pointer	O
to	O
memory	O
from	O
the	O
pool	O
.	O
</s>
<s>
Actual	O
deallocation	B-General_Concept
of	O
memory	O
can	O
be	O
deferred	O
until	O
the	O
lifetime	O
of	O
the	O
memory	B-General_Concept
pool	I-General_Concept
ends	O
.	O
</s>
<s>
An	O
example	O
of	O
memory	O
pool-based	O
allocators	B-Application
can	O
be	O
found	O
in	O
the	O
Boost	B-Language
C++	I-Language
Libraries	I-Language
.	O
</s>
<s>
Another	O
viable	O
use	O
of	O
custom	O
allocators	B-Application
is	O
for	O
debugging	O
memory-related	O
errors	O
.	O
</s>
<s>
This	O
could	O
be	O
achieved	O
by	O
writing	O
an	O
allocator	B-Application
that	O
allocates	O
extra	O
memory	O
in	O
which	O
it	O
places	O
debugging	O
information	O
.	O
</s>
<s>
Such	O
an	O
allocator	B-Application
could	O
be	O
used	O
to	O
ensure	O
that	O
memory	O
is	O
allocated	O
and	O
deallocated	O
by	O
the	O
same	O
type	O
of	O
allocator	B-Application
,	O
and	O
also	O
provide	O
limited	O
protection	O
against	O
overruns	B-General_Concept
.	O
</s>
<s>
In	O
short	O
,	O
this	O
paragraph	O
(	O
...	O
)	O
is	O
the	O
Standard	O
's	O
"	O
I	O
have	O
a	O
dream	O
"	O
speech	O
for	O
allocators	B-Application
.	O
</s>
<s>
The	O
subject	O
of	O
custom	O
allocators	B-Application
has	O
been	O
treated	O
by	O
many	O
C++	B-Language
experts	O
and	O
authors	O
,	O
including	O
Scott	O
Meyers	O
in	O
Effective	O
STL	B-Application
and	O
Andrei	O
Alexandrescu	O
in	O
Modern	O
C++	B-Language
Design	O
.	O
</s>
<s>
Meyers	O
emphasises	O
that	O
C++98	O
requires	O
all	O
instances	O
of	O
an	O
allocator	B-Application
to	O
be	O
equivalent	O
,	O
and	O
notes	O
that	O
this	O
in	O
effect	O
forces	O
portable	B-Architecture
allocators	B-Application
to	O
not	O
have	O
state	O
.	O
</s>
<s>
Although	O
the	O
C++98	O
Standard	O
did	O
encourage	O
library	B-Library
implementors	O
to	O
support	O
stateful	O
allocators	B-Application
,	O
Meyers	O
calls	O
the	O
relevant	O
paragraph	O
"	O
a	O
lovely	O
sentiment	O
"	O
that	O
"	O
offers	O
you	O
next	O
to	O
nothing	O
"	O
,	O
characterizing	O
the	O
restriction	O
as	O
"	O
draconian	O
"	O
.	O
</s>
<s>
In	O
The	O
C++	B-Language
Programming	I-Language
Language	I-Language
,	O
Bjarne	O
Stroustrup	O
,	O
on	O
the	O
other	O
hand	O
,	O
argues	O
that	O
the	O
"	O
apparently	O
[d]raconian	O
restriction	O
against	O
per-object	O
information	O
in	O
allocators	B-Application
is	O
not	O
particularly	O
serious	O
"	O
,	O
pointing	O
out	O
that	O
most	O
allocators	B-Application
do	O
not	O
need	O
state	O
,	O
and	O
have	O
better	O
performance	O
without	O
it	O
.	O
</s>
<s>
He	O
mentions	O
three	O
use	O
cases	O
for	O
custom	O
allocators	B-Application
,	O
namely	O
,	O
memory	B-General_Concept
pool	I-General_Concept
allocators	B-Application
,	O
shared	B-Operating_System
memory	I-Operating_System
allocators	B-Application
,	O
and	O
garbage	B-General_Concept
collected	I-General_Concept
memory	I-General_Concept
allocators	B-Application
.	O
</s>
<s>
He	O
presents	O
an	O
allocator	B-Application
implementation	O
that	O
uses	O
an	O
internal	O
memory	B-General_Concept
pool	I-General_Concept
for	O
fast	O
allocation	B-Application
and	I-Application
deallocation	I-Application
of	O
small	O
chunks	O
of	O
memory	O
,	O
but	O
notes	O
that	O
such	O
an	O
optimization	O
may	O
already	O
be	O
performed	O
by	O
the	O
allocator	B-Application
provided	O
by	O
the	O
implementation	O
.	O
</s>
<s>
When	O
instantiating	O
one	O
of	O
the	O
standard	O
containers	B-Application
,	O
the	O
allocator	B-Application
is	O
specified	O
through	O
a	O
template	B-Application
argument	O
,	O
which	O
defaults	B-Language
to	O
std::allocatorxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
:	O
</s>
<s>
Like	O
all	O
C++	B-Application
class	I-Application
templates	B-Application
,	O
instantiations	O
of	O
standard	O
library	B-Library
containers	B-Application
with	O
different	O
allocator	B-Application
arguments	O
are	O
distinct	O
types	O
.	O
</s>
<s>
A	O
function	O
expecting	O
an	O
std::vectorxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
argument	O
will	O
therefore	O
only	O
accept	O
a	O
vector	O
instantiated	O
with	O
the	O
default	O
allocator	B-Application
.	O
</s>
<s>
The	O
C++11	B-Language
standard	O
has	O
enhanced	O
the	O
allocator	B-Application
interface	O
to	O
allow	O
"	O
scoped	O
"	O
allocators	B-Application
,	O
so	O
that	O
containers	B-Application
with	O
"	O
nested	O
"	O
memory	B-General_Concept
allocations	I-General_Concept
,	O
such	O
as	O
vector	O
of	O
strings	O
or	O
a	O
map	B-Language
of	O
lists	O
of	O
sets	O
of	O
user-defined	O
types	O
,	O
can	O
ensure	O
that	O
all	O
memory	O
is	O
sourced	O
from	O
the	O
container	B-Application
's	O
allocator	B-Application
.	O
</s>
