Broken Compiler Workarounds

Overview
Reference
1. Standard header <ios>
2. Templated Streams
3. Templated Stream Buffers
4. Character Traits
5. Chain Component Access

Overview

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.

Reference

1. Standard header <ios>

Headers

<boost/iostreams/detail/ios.hpp>

Synopsis

#define BOOST_IOSTREAMS_BASIC_IOS(ch, tr) ...
#define BOOST_IOS ...
#define BOOST_IOSTREAMS_FAILURE ...

BOOST_IOSTREAMS_BASIC_IOS

Expands to std::basic_ios<ch, tr> for standard libraries which support templated streams, and to std::ios otherwise.

BOOST_IOS

Expands to std::ios_base if available, and to std::ios otherwise. To access the nested class std::ios_base::failure, use BOOST_IOSTREAMS_FAILURE.

BOOST_IOSTREAMS_FAILURE

Expands to std::ios_base::failure if available, and to a suitable derived class of std::exception otherwise.

2. Templated Streams

Headers

<boost/iostreams/detail/iostream.hpp>

Synopsis

#define BOOST_IOSTREAMS_BASIC_ISTREAM(ch, tr) ...
#define BOOST_IOSTREAMS_BASIC_OSTREAM(ch, tr) ...
#define BOOST_IOSTREAMS_BASIC_IOSTREAM(ch, tr) ...

BOOST_IOSTREAMS_BASIC_ISTREAM

Expands to std::basic_istream<ch, tr> for standard libraries which support templated streams, and to std::istream otherwise.

BOOST_IOSTREAMS_BASIC_OSTREAM

Expands to std::basic_ostream<ch, tr> for standard libraries which support templated streams, and to std::ostream otherwise.

BOOST_IOSTREAMS_BASIC_IOSTREAM

Expands to std::basic_iostream<ch, tr> for standard libraries which support templated streams, and to std::iostream otherwise.

3. Templated Stream Buffers

Headers

<boost/iostreams/detail/streambuf.hpp>

Synopsis

#define BOOST_IOSTREAMS_BASIC_STREAMBUF(ch, tr) ...
#define BOOST_IOSTREAMS_PUBSEEKOFF ...
#define BOOST_IOSTREAMS_PUBSEEKPOS ...
#define BOOST_IOSTREAMS_PUBSYNC ...

BOOST_IOSTREAMS_BASIC_STREAMBUF

Expands to std::basic_streambuf<ch, tr> for standard libraries which support std::basic_streambuf, and to std::streambuf otherwise.

BOOST_IOSTREAMS_PUBSEEKOFF

Expands to pubseekoff for standard libraries which support std::basic_streambuf::pubseekoff, and to seekoff otherwise.

BOOST_IOSTREAMS_PUBSEEKPOS

Expands to pubseekpos for standard libraries which support std::basic_streambuf::pubseekpos, and to seekpos otherwise.

BOOST_IOSTREAMS_PUBSYNC

Expands to pubsync for standard libraries which support std::basic_streambuf::pubsync, and to sync otherwise.

4. Character Traits

Headers

<boost/iostreams/detail/char_traits.hpp>

Synopsis

#define BOOST_IOSTREAMS_CHAR_TRAITS(ch) ...

BOOST_IOSTREAMS_CHAR_TRAITS

Expands to std::char_traits<ch> for standard libraries which support std::char_traits, and to a substitute for std::char_traits<char> otherwise.

5. Chain Component Access

Headers

<boost/iostreams/chain.hpp>

Synopsis

#define BOOST_IOSTREAMS_COMPONENT_TYPE(chain, n) ...
#define BOOST_IOSTREAMS_COMPONENT(chain, n, t) ...

BOOST_IOSTREAMS_COMPONENT_TYPE

Used in place of chain.component_type(n) for compilers which don't support explicit specification of member function template arguments. chain can be an instance of filtering_stream, filtering_streambuf or basic_chain.

This macro is deprecated. Use chain.component_type(n) instead.

BOOST_IOSTREAMS_COMPONENT

Used in place of chain.component<t>(n) for compilers which don't support explicit specification of member function template arguments. chain can be an instance of filtering_stream, filtering_streambuf or basic_chain.