Next: High Integrity CPP Guideline 17.21  Up: 17 Standard Template Library (STL)  Previous: High Integrity CPP Rule 17.19  Contents

High Integrity CPP Rule 17.20   Directly include necessary STL headers.

Justification

Some implementations may include extra STL headers not explicitly specified by the standard. Code that is dependent on these indirect inclusions and does not directly include the appropriate header in the source file will be non portable.

   
   #include <vector>
   
   void foo()
   {
      // May work with some STL implementations which include 
      // < string > in < vector >
      //
      std::string s;
   }
Reference

Effective STL Item 48;


HICPP VERSION 2.4  http://www.codingstandard.com   Copyright: © 2007 THE PROGRAMMING RESEARCH GROUP