[mem.poly.allocator.ctor]

# 20 Memory management library [[mem]](./#mem)

## 20.5 Memory resources [[mem.res]](mem.res#mem.poly.allocator.ctor)

### 20.5.3 Class template polymorphic_allocator [[mem.poly.allocator.class]](mem.poly.allocator.class#mem.poly.allocator.ctor)

#### 20.5.3.2 Constructors [mem.poly.allocator.ctor]

[ð](#lib:polymorphic_allocator,constructor)

`polymorphic_allocator() noexcept;
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L7728)

*Effects*: Sets memory_rsrc to get_default_resource()[.](#1.sentence-1)

[ð](#lib:polymorphic_allocator,constructor_)

`polymorphic_allocator(memory_resource* r);
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L7739)

*Preconditions*: r is non-null[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L7743)

*Effects*: Sets memory_rsrc to r[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L7747)

*Throws*: Nothing[.](#4.sentence-1)

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L7751)

[*Note [1](#note-1)*:

This constructor provides an implicit conversion from memory_resource*[.](#5.sentence-1)

â *end note*]

[ð](#lib:polymorphic_allocator,constructor__)

`template<class U> polymorphic_allocator(const polymorphic_allocator<U>& other) noexcept;
`

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L7763)

*Effects*: Sets memory_rsrc to other.resource()[.](#6.sentence-1)
