Usage

Let's test this container to ensure that each constructor works as expected:

int main(void)
{
auto alloc = std::allocator<int>();

container<int> c1;
container<int> c2(alloc);
container<int> c3(42, 42);
container<int> c4(42);
container<int> c5(c1, alloc);
container<int> c6(std::move(c1));
container<int> c7(std::move(c2), alloc);
container<int> c8{4, 42, 15, 8, 23, 16};

return 0;
}

As shown in the preceding code block, we test our constructors by calling each one, which results in the following output:

As you can see, each constructor was successfully executed as expected.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset