1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4 <TITLE>Broken Compiler Workarounds</TITLE> 5 <LINK REL="stylesheet" HREF="../../../../boost.css"> 6 <LINK REL="stylesheet" HREF="../theme/iostreams.css"> 7</HEAD> 8<STYLE> 9 DT A { /*text-decoration:none*/ } 10 LI A { /*text-decoration:none;*/ font: 80% Verdana, Tahoma, Arial, Helvetica, sans-serif } 11</STYLE> 12<BODY> 13 14<!-- Begin Banner --> 15 16 <H1 CLASS="title">Broken Compiler Workarounds</H1> 17 <HR CLASS="banner"> 18 19<!-- End Banner --> 20 21<DL class="page-index"> 22 <DT><A href="#overview">Overview</A></DT> 23 <DT><A href="#reference">Reference</A> 24 <DL class="page-index"> 25 <DT><A href="#ios">1. Standard header <CODE><ios></CODE></A></DT> 26 <DT><A href="#streams">2. Templated Streams</A></DT> 27 <DT><A href="#streambufs">3. Templated Stream Buffers</A></DT> 28 <DT><A href="#streambufs">4. Character Traits</A></DT> 29 <DT><A href="#component_access">5. Chain Component Access</A></DT> 30 </DL> 31 </DT> 32</DL> 33 34<HR> 35 36<A NAME="overview"></A> 37<H2>Overview</H2> 38 39<P> 40 The Boost Iostreams library contains several macros useful for writing code which works with compilers which fail to support certain core language features and with defective standard library implementations, such as those which do not provide template streams. 41</P> 42 43<A NAME="reference"></A> 44<H2>Reference</H2> 45 46<A NAME="ios"></A> 47<H3>1. Standard header <CODE><ios></CODE></H3> 48 49<A NAME="ios_headers"></A> 50<H3>Headers</H3> 51 52<DL class="page-index"> 53 <DT><A CLASS="header" HREF="../../../../boost/iostreams/detail/ios.hpp"><CODE><boost/iostreams/detail/ios.hpp></CODE></A></DT> 54</DL> 55 56<A NAME="ios_synopsis"></A> 57<H3>Synopsis</H3> 58 59<PRE CLASS='broken_ie'><SPAN CLASS='preprocessor'>#define</SPAN> <A CLASS='documented' HREF="#boost_iostreams_basic_ios">BOOST_IOSTREAMS_BASIC_IOS</A>(ch, tr) ... 60<SPAN CLASS='preprocessor'>#define</SPAN> <A CLASS='documented' HREF="#boost_ios">BOOST_IOS</A> ... 61<SPAN CLASS='preprocessor'>#define</SPAN> <A CLASS='documented' HREF="#boost_iostreams_failure">BOOST_IOSTREAMS_FAILURE</A> ...</PRE> 62 63<A NAME="boost_iostreams_basic_ios"></A> 64<H4><CODE>BOOST_IOSTREAMS_BASIC_IOS</CODE></H4> 65 66<P>Expands to <CODE>std::basic_ios<ch, tr></CODE> for standard libraries which support templated streams, and to <CODE>std::ios</CODE> otherwise.</P> 67 68<A NAME="boost_ios"></A> 69<H4><CODE>BOOST_IOS</CODE></H4> 70 71<P>Expands to <CODE>std::ios_base</CODE> if available, and to <CODE>std::ios</CODE> otherwise. To access the nested class <CODE>std::ios_base::failure</CODE>, use <A HREF="#boost_iostreams_failure"><CODE>BOOST_IOSTREAMS_FAILURE</CODE></A>. 72 73<A NAME="boost_iostreams_failure"></A> 74<H4><CODE>BOOST_IOSTREAMS_FAILURE</CODE></H4> 75 76<P>Expands to <CODE>std::ios_base::failure</CODE> if available, and to a suitable derived class of <CODE>std::exception</CODE> otherwise.</P> 77 78<A NAME="streams"></A> 79<H3>2. Templated Streams</H3> 80 81<A NAME="streams_headers"></A> 82<H3>Headers</H3> 83 84<DL class="page-index"> 85 <DT><A CLASS="header" HREF="../../../../boost/iostreams/detail/iostream.hpp"><CODE><boost/iostreams/detail/iostream.hpp></CODE></A></DT> 86</DL> 87 88<A NAME="streams_synopsis"></A> 89<H3>Synopsis</H3> 90 91<PRE CLASS='broken_ie'><SPAN CLASS='preprocessor'>#define</SPAN> <A CLASS='documented' HREF="#boost_iostreams_basic_istream">BOOST_IOSTREAMS_BASIC_ISTREAM</A>(ch, tr) ... 92#define</SPAN> <A CLASS='documented' HREF="#boost_iostreams_basic_ostream">BOOST_IOSTREAMS_BASIC_OSTREAM</A>(ch, tr) ... 93#define</SPAN> <A CLASS='documented' HREF="#boost_iostreams_basic_iostream">BOOST_IOSTREAMS_BASIC_IOSTREAM</A>(ch, tr) ...</PRE> 94 95<A NAME="boost_iostreams_basic_istream"></A> 96<H4><CODE>BOOST_IOSTREAMS_BASIC_ISTREAM</CODE></H4> 97 98<P>Expands to <CODE>std::basic_istream<ch, tr></CODE> for standard libraries which support templated streams, and to <CODE>std::istream</CODE> otherwise.</P> 99 100<A NAME="boost_iostreams_basic_ostream"></A> 101<H4><CODE>BOOST_IOSTREAMS_BASIC_OSTREAM</CODE></H4> 102 103<P>Expands to <CODE>std::basic_ostream<ch, tr></CODE> for standard libraries which support templated streams, and to <CODE>std::ostream</CODE> otherwise.</P> 104 105<A NAME="boost_iostreams_basic_iostream"></A> 106<H4><CODE>BOOST_IOSTREAMS_BASIC_IOSTREAM</CODE></H4> 107 108<P>Expands to <CODE>std::basic_iostream<ch, tr></CODE> for standard libraries which support templated streams, and to <CODE>std::iostream</CODE> otherwise.</P> 109 110<A NAME="streambufs"></A> 111<H3>3. Templated Stream Buffers</H3> 112 113<A NAME="streambufs_headers"></A> 114<H3>Headers</H3> 115 116<DL class="page-index"> 117 <DT><A CLASS="header" HREF="../../../../boost/iostreams/detail/iostream.hpp"><CODE><boost/iostreams/detail/streambuf.hpp></CODE></A></DT> 118</DL> 119 120<A NAME="streambufs_synopsis"></A> 121<H3>Synopsis</H3> 122 123<PRE CLASS='broken_ie'><SPAN CLASS='preprocessor'>#define</SPAN> <A CLASS='documented' HREF="#boost_iostreams_basic_streambuf">BOOST_IOSTREAMS_BASIC_STREAMBUF</A>(ch, tr) ... 124#define</SPAN> <A CLASS='documented' HREF="#boost_iostreams_pubseekoff">BOOST_IOSTREAMS_PUBSEEKOFF</A> ... 125#define</SPAN> <A CLASS='documented' HREF="#boost_iostreams_pubseekpos">BOOST_IOSTREAMS_PUBSEEKPOS</A> ... 126#define</SPAN> <A CLASS='documented' HREF="#boost_iostreams_pubsync">BOOST_IOSTREAMS_PUBSYNC</A> ...</PRE> 127 128<A NAME="boost_iostreams_basic_streambuf"></A> 129<H4><CODE>BOOST_IOSTREAMS_BASIC_STREAMBUF</CODE></H4> 130 131<P>Expands to <CODE>std::basic_streambuf<ch, tr></CODE> for standard libraries which support <CODE>std::basic_streambuf</CODE>, and to <CODE>std::streambuf</CODE> otherwise.</P> 132 133 134<A NAME="boost_iostreams_pubseekoff"></A> 135<H4><CODE>BOOST_IOSTREAMS_PUBSEEKOFF</CODE></H4> 136 137<P>Expands to <CODE>pubseekoff</CODE> for standard libraries which support <CODE>std::basic_streambuf::pubseekoff</CODE>, and to <CODE>seekoff</CODE> otherwise.</P> 138 139<A NAME="boost_iostreams_pubseekpos"></A> 140<H4><CODE>BOOST_IOSTREAMS_PUBSEEKPOS</CODE></H4> 141 142<P>Expands to <CODE>pubseekpos</CODE> for standard libraries which support <CODE>std::basic_streambuf::pubseekpos</CODE>, and to <CODE>seekpos</CODE> otherwise.</P> 143 144<A NAME="boost_iostreams_pubsync"></A> 145<H4><CODE>BOOST_IOSTREAMS_PUBSYNC</CODE></H4> 146 147<P>Expands to <CODE>pubsync</CODE> for standard libraries which support <CODE>std::basic_streambuf::pubsync</CODE>, and to <CODE>sync</CODE> otherwise.</P> 148 149<A NAME="char_traits"></A> 150<H3>4. Character Traits</H3> 151 152<A NAME="char_traits_headers"></A> 153<H3>Headers</H3> 154 155<DL class="page-index"> 156 <DT><A CLASS="header" HREF="../../../../boost/iostreams/detail/char_traits.hpp"><CODE><boost/iostreams/detail/char_traits.hpp></CODE></A></DT> 157</DL> 158 159<A NAME="char_traits_synopsis"></A> 160<H3>Synopsis</H3> 161 162<PRE CLASS='broken_ie'><SPAN CLASS='preprocessor'>#define</SPAN> <A CLASS='documented' HREF="#boost_iostreams_char_traits">BOOST_IOSTREAMS_CHAR_TRAITS</A>(ch) ...</PRE> 163 164<A NAME="boost_iostreams_char_traits"></A> 165<H4><CODE>BOOST_IOSTREAMS_CHAR_TRAITS</CODE></H4> 166 167 168<P>Expands to <CODE>std::char_traits<ch></CODE> for standard libraries which support <CODE>std::char_traits</CODE>, and to a substitute for <CODE>std::char_traits<char></CODE> otherwise.</P> 169<A NAME="component_access"></A> 170<H3>5. Chain Component Access</H3> 171 172<A NAME="component_access_headers"></A> 173<H3>Headers</H3> 174 175<DL class="page-index"> 176 <DT><A CLASS="header" HREF="../../../../boost/iostreams/chain.hpp"><CODE><boost/iostreams/chain.hpp></CODE></A></DT> 177</DL> 178 179<A NAME="component_access_synopsis"></A> 180<H3>Synopsis</H3> 181 182<PRE CLASS='broken_ie'><SPAN CLASS='preprocessor'>#define</SPAN> <A CLASS='documented' HREF="#boost_iostreams_component_type">BOOST_IOSTREAMS_COMPONENT_TYPE</A>(chain, n) ... 183<SPAN CLASS='preprocessor'>#define</SPAN> <A CLASS='documented' HREF="#boost_iostreams_component">BOOST_IOSTREAMS_COMPONENT</A>(chain, n, t) ...</PRE> 184 185<A NAME="boost_iostreams_component_type"></A> 186<H4><CODE>BOOST_IOSTREAMS_COMPONENT_TYPE</CODE></H4> 187 188<P>Used in place of <CODE>chain.component_type(n)</CODE> for compilers which don't support explicit specification of member function template arguments. <CODE>chain</CODE> can be an instance of <A HREF="../classes/filtering_stream.html"><CODE>filtering_stream</CODE></A>, <A HREF="../classes/filtering_streambuf.html"><CODE>filtering_streambuf</CODE></A> or <A HREF="../classes/chain.html"><CODE>basic_chain</CODE></A>.</P> 189 190<P><I>This macro is deprecated. Use <CODE>chain.component_type(n)</CODE> instead.</I></P> 191 192<A NAME="boost_iostreams_component"></A> 193<H4><CODE>BOOST_IOSTREAMS_COMPONENT</CODE></H4> 194 195<P>Used in place of <CODE>chain.component<t>(n)</CODE> for compilers which don't support explicit specification of member function template arguments. <CODE>chain</CODE> can be an instance of <A HREF="../classes/filtering_stream.html"><CODE>filtering_stream</CODE></A>, <A HREF="../classes/filtering_streambuf.html"><CODE>filtering_streambuf</CODE></A> or <A HREF="../classes/chain.html"><CODE>basic_chain</CODE></A>.</P> 196 197<HR STYLE="margin-top:1em"> 198 199<!-- Begin Footer --> 200 201 202<P CLASS="copyright">© Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>© Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" target="_top">Jonathan Turkanis</a><br/>Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <A HREF="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>) 203</P> 204 205<!-- End Footer --> 206 207</BODY>