1 // ----------------------------------------------------------------------------
2 // compat_workarounds : general framework for non-conformance workarounds
3 // ----------------------------------------------------------------------------
5 // Copyright Samuel Krempp 2003. Use, modification, and distribution are
6 // subject to the Boost Software License, Version 1.0. (See accompanying
7 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 // see http://www.boost.org/libs/format for library home page
11 // ----------------------------------------------------------------------------
14 // this file defines wrapper classes to hide non-conforming
15 // std::char_traits<> and std::allocator<> traits
16 // and Includes : config_macros.hpp (defines config macros
17 // and compiler-specific switches)
19 // Non-conformant Std-libs fail to supply conformant traits (std::char_traits,
20 // std::allocator) and/or the std::string doesnt support them.
21 // We don't want to have hundreds of #ifdef workarounds, so we define
22 // replacement traits.
23 // But both char_traits and allocator traits are visible in the interface,
24 // (inside the final string type), thus we need to keep both
25 // the replacement type (typedefed to 'compatible_type') for real use,
26 // and the original stdlib type (typedef to 'type_for_string') for interface
27 // visibility. This is what Compat* classes do (as well as be transparent
28 // when good allocator and char traits are present)
30 #ifndef BOOST_FORMAT_COMPAT_WORKAROUNDS_HPP
31 #define BOOST_FORMAT_COMPAT_WORKAROUNDS_HPP
36 // gcc-2.95 char traits (non-conformantly named string_char_traits)
37 // lack several functions so we extend them in a replacement class.
41 // std::allocator<Ch> in gcc-2.95 is ok, but basic_string only works
42 // with plain 'std::alloc' still, alt_stringbuf requires a functionnal
43 // alloc template argument, so we need a replacement allocator
50 #include <boost/format/detail/config_macros.hpp>
51 // sets-up macros and load compiler-specific workarounds headers.
53 #if !defined(BOOST_FORMAT_STREAMBUF_DEFINED)
54 // workarounds-gcc-2.95 might have defined own streambuf
58 #if !defined(BOOST_FORMAT_OSTREAM_DEFINED)
59 // workarounds-gcc-2.95 might already have included <iostream>
68 // **** CompatTraits general definitions : ----------------------------
71 { // general case : be transparent
73 typedef Tr compatible_type;
76 // **** CompatAlloc general definitions : -----------------------------
79 { // general case : be transparent
81 typedef Alloc compatible_type;
86 #endif // include guard