Vector is a template type, meaning that every piece of code that refers to a vector must know the full type. Not only is your Knwo library about SomeOtherClass and SomeOtherTemplateType, they need to know about them in order to reference their vector.
In this case, the full type of your vector:
std::vector<SomeOtherClass<SomeOtherTemplateType>,std::allocator<SomeOtherClass<SomeOtherTemplateType> > >
... which is probably declared in your code something like this:
vector<SomeOtherClass<SomeOtherTemplateType> > thatVector;
... with a dispenser allowing the default template argument.
Now, to your problem with corruption. There is little information about the nature of corruption, so I am going to make a few assumptions. Nameley, that you select a vector in one module and try to do something with it (for example, push_back in to it) in another module, and that this is when you do something in another module, when the damage actually occurs. Disappointingly, in many of these cases, corruption is not detected or reported when corruption occurs. This is often discovered much later in completely unrelated codes.
If the above assumptions are true, I have 2 suggestions regarding a possible reason:
Modules are not associated with the same version and taste of runtime libraries. Try to make sure that each module is connected to the same CRT (for example, multi-threaded Debug DLL for Windows) and try again. In most cases this is a problem.
Different compilers (or different versions of the same compiler) are used to create different modules. In this case, the vector looks like one for one module and looks somehow different for another module. There are many threads that foolishly discuss this issue; see here for one example.
source share