[C++-sig] std::wstring availability

Jonathan Brandmeyer jbrandmeyer at earthlink.net
Sat Oct 4 00:05:43 CEST 2003


The attached patch uses a predefined macro to exclude wstring support
when it is not available on the platform's standard library.

The code to set the macro is already supplied in
boost/config/stdlib/*.hpp

Thanks,
Jonathan Brandmeyer


Index: builtin_converters.cpp
===================================================================
RCS file:
/boost/boost/libs/python/src/converter/builtin_converters.cpp,v
retrieving revision 1.25
diff -w -d -u -r1.25 builtin_converters.cpp
--- builtin_converters.cpp      11 Sep 2003 19:19:55 -0000      1.25
+++ builtin_converters.cpp      3 Oct 2003 22:00:50 -0000
@@ -22,6 +22,10 @@
 #include <string>
 #include <complex>
  
+#ifndef BOOST_NO_STD_WSTRING
+# include <wstring>
+#endif
+
 namespace boost { namespace python { namespace converter {
  
 shared_ptr_deleter::shared_ptr_deleter(handle<> owner)
@@ -272,6 +276,7 @@
       }
   };
  
+#ifndef BOOST_NO_STD_WSTRING
   // encode_string_unaryfunc/py_encode_string -- manufacture a
unaryfunc
   // "slot" which encodes a Python string using the default encoding
   extern "C" PyObject* encode_string_unaryfunc(PyObject* x)
@@ -307,6 +312,7 @@
           return result;
       }
   };
+#endif // !BOOST_NO_STD_WSTRING
  
   struct complex_rvalue_from_python
   {
@@ -403,7 +409,9 @@
     registry::insert(convert_to_cstring,type_id<char>());
  
     // Register by-value converters to std::string, std::wstring
+# ifndef BOOST_NO_STD_WSTRING
     slot_rvalue_from_python<std::wstring,
wstring_rvalue_from_python>();
+# endif
     slot_rvalue_from_python<std::string, string_rvalue_from_python>();
 }
  






More information about the Cplusplus-sig mailing list