Challenge: Concept for a Container

Let’s implement a concept for a container ourselves.

We'll cover the following


Write a concept for a container with the following functions:

  • Insert: This takes an instance of the contained type and returns void.
  • Pop: This takes an index and returns the contained type.

The concept requires that it has a member type called size_type.

Try it yourself first. If you have trouble getting to the solution, you can always press the “Show Solution” button to see how the problem can be solved. We’ll go through the in-depth solution in the next lesson.

Good luck!

Get hands-on with 1200+ tech skills courses.