[vtk-developers] STL policy & MSVC warnings

Brad King brad.king at kitware.com
Tue Apr 22 10:51:03 EDT 2003


Hello, all:

Those who have used STL class templates in VTK code know that one must use
"vtkstd::" as the namespace instead of "std::".  This requirement is an
implementation detail to support older compilers.  Until now, we have
allowed the headers themselves to be included as

#include <set>
#include <vector>
// ...

Since we now use the "/W4" warning level for Visual Studio, it gives
several warnings in STL system headers.  To disable these warnings, we
began using "#pragma warning (push,1)" and "#pragma warning (pop)" around
the inclusion of STL headers.  Remembering to do this everywhere the
headers are included requires too much maintenance.

The new policy is to include STL headers like this:

#include <vtkstd/set>
#include <vtkstd/vector>

These are small wrappers around the STL headers that are generated by the
build process.  They contain all the needed "#pragma" lines surrounding
the inclusion of the real headers.  This is another implementation detail
to support so many platforms.

All current STL usage in VTK has been updated to use this policy.  Please
remember to use it when writing new code.

Thanks,
-Brad




More information about the vtk-developers mailing list