In this chapter, you will learn how to create your own custom container in C++ by leveraging an existing container that the C++ Standard Template Library already provides. This chapter is important because, in a lot of cases, your code will have common operations that are performed on a Standard Template Library container that are duplicated throughout the code (as is the case with implementing thread safety). The recipes in this chapter will teach you how to easily encapsulate this duplicated code into a custom container without having to write your own container from scratch or littering your code with duplicated logic that is hard to test and validate.
Throughout this chapter, you will learn the skills needed to implement a custom wrapper container, capable of ensuring that std::vector is maintained in sorted order at all times....