libstdc++: iosfwd Source File

libstdc++

iosfwd
Go to the documentation of this file.
1// <iosfwd> Forward declarations -*- C++ -*-
2
3// Copyright (C) 1997-2026 Free Software Foundation, Inc.
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
19
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
24
25/** @file include/iosfwd
26 * This is a Standard C++ Library header.
27 */
28
29//
30// ISO C++ 14882: 27.2 Forward declarations
31//
32
33#ifndef _GLIBCXX_IOSFWD
34#define _GLIBCXX_IOSFWD 1
35
36#ifdef _GLIBCXX_SYSHDR
37#pragma GCC system_header
38#endif
39
40#include <bits/requires_hosted.h> // iostreams
41
42 /**
43 * @defgroup io I/O
44 *
45 * Nearly all of the I/O classes are parameterized on the type of
46 * characters they read and write. (The major exception is `ios_base` at
47 * the top of the hierarchy.) This is a change from pre-Standard
48 * streams, which were not templates.
49 *
50 * For ease of use and compatibility, all of the `basic_*` I/O-related
51 * classes are given typedef names for both of the builtin character
52 * widths (wide and narrow). The typedefs are the same as the
53 * pre-Standard names, for example:
54 *
55 * ```
56 * typedef basic_ifstream<char> ifstream;
57 * ```
58 *
59 * Because properly forward-declaring these classes can be difficult, you
60 * should not do it yourself. Instead, include the `<iosfwd>`
61 * header, which contains only declarations of all the I/O classes as
62 * well as the typedefs. Trying to forward-declare the typedefs
63 * themselves (e.g., `class ostream;`) is not valid ISO C++.
64 *
65 * For more specific declarations, see
66 * https://gcc.gnu.org/onlinedocs/libstdc++/manual/io.html#std.io.objects
67 */
68
69#include <bits/iosfwd_file.h>
70#include <bits/iosfwd_string.h>
71#include <bits/iosfwd_sync.h>
72#include <bits/iosfwd_span.h>
73
74#endif /* _GLIBCXX_IOSFWD */
iosfwd_file.h
iosfwd_span.h
iosfwd_string.h
iosfwd_sync.h
requires_hosted.h