ANSI C++ changes revisited
Peter.Vanroose at esat.kuleuven.ac.be
Peter.Vanroose at esat.kuleuven.ac.be
Thu Apr 27 12:59:26 EDT 2000
> just a not about the "using std::ostream"... You should NOT do this if
> it is in a header file, because any who include you header file will
> have the "using std::ostream" effctive for his files...
Actually, the most flexible solution (which I would advocate) is not to
chose for either "std::ostream" or "using std" in your source files, but
instead place a conditional "using std::ostream" in a header file that
is included anywhere.
E.g., one could have a file vtk_iostream.h that says (for example :-)
#if defined(WIN32) || defined(I_WANT_STD) && !(__GNUC__ < 3)
#include <iostream>
using std::ios;
using std::cin;
using std::cout;
(etc)
#else
#include <iostream.h>
#endif
With the only extra discipline that you always have to include vtk_iostream.h
instead of iostream.h, this makes it completely transparant and user-selectable
which of the two forms are used throughout your code. And for any compiler.
-- Peter Vanroose
Electrotechnical Department (ESAT/PSI)
K.U. Leuven, Belgium.
Peter.Vanroose at esat.kuleuven.ac.be
--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------
More information about the vtkusers
mailing list