compat_workarounds.hpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // compat_workarounds : general framework for non-conformance workarounds
3 // ----------------------------------------------------------------------------
4 
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)
8 
9 // see http://www.boost.org/libs/format for library home page
10 
11 // ----------------------------------------------------------------------------
12 
13 
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)
18 
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)
29 
30 #ifndef BOOST_FORMAT_COMPAT_WORKAROUNDS_HPP
31 #define BOOST_FORMAT_COMPAT_WORKAROUNDS_HPP
32 
33 namespace boost {
34  namespace io {
35 
36  // gcc-2.95 char traits (non-conformantly named string_char_traits)
37  // lack several functions so we extend them in a replacement class.
38  template<class Tr>
39  class CompatTraits;
40 
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
44  template<class Alloc>
45  class CompatAlloc;
46  } // N.S. io
47 }// N.S. boost
48 
49 
51  // sets-up macros and load compiler-specific workarounds headers.
52 
53 #if !defined(BOOST_FORMAT_STREAMBUF_DEFINED)
54 // workarounds-gcc-2.95 might have defined own streambuf
55 #include <streambuf>
56 #endif
57 
58 #if !defined(BOOST_FORMAT_OSTREAM_DEFINED)
59 // workarounds-gcc-2.95 might already have included <iostream>
60 #include <ostream>
61 #endif
62 
63 
64 
65 namespace boost {
66  namespace io {
67 
68  // **** CompatTraits general definitions : ----------------------------
69  template<class Tr>
70  class CompatTraits
71  { // general case : be transparent
72  public:
73  typedef Tr compatible_type;
74  };
75 
76  // **** CompatAlloc general definitions : -----------------------------
77  template<class Alloc>
78  class CompatAlloc
79  { // general case : be transparent
80  public:
81  typedef Alloc compatible_type;
82  };
83 
84  } //N.S. io
85 } // N.S. boost
86 #endif // include guard
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Thu Dec 22 2022 03:43:16