How can I overload the STL implementation for methods like find, erase and insert to take varying parameters? I tried to look up the overloading of STL methods but couldn't find any help.
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
- What is the correct way to declare and use a FILE
You can't overload the methods of a class without editing the code of that class.
Write your own free functions that act as helpers; they would take the relevant container class as the first parameter.
You can inherit from a class and add methods that way, but the std container classes are not designed to be inherited from.
You are not allowed to do this; the standard prohibits it.
You are not allowed to add overloads in the std namespace. Only specialization of functions and algorithms for your own data types are allowed. If you do want a different find, erase, insert... implement a wrapper (out of the std namespace) and use it.
And I would not recommend it either... What kind of overloads do you want to provide?