James Kanze
11/18/2008 9:57:00 AM
On Nov 17, 5:20 pm, Bernd Gaertner <gaert...@inf.ethz.ch> wrote:
> according to the standard, manipulators like noskipws are
> declared in the header ios ([lib.iostreams.base]). But when I
> look at code that is around, I usually see #include<iomanip>
> being used. What is the correct include, and why?
It's rather arbitrary from a user point of view, but
manipulators which require an argument are declared in
<iomanip>, and those that don't are declared in <ios>. (There
are also a few, like endl, which only work on an ostream, and
are declared in <ostream>.) The reason behind this distinction
is mainly one of implementation; a manipulator which takes an
argument requires an additional type, which must be defined; if
you only include <ios>, you don't get a definition these types.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34