1 // Copyright David Abrahams 2002.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef STRING_LITERAL_DWA2002629_HPP
6 # define STRING_LITERAL_DWA2002629_HPP
7 
8 # include <cstddef>
9 # include <boost/type.hpp>
10 # include <boost/python/detail/type_traits.hpp>
11 # include <boost/mpl/bool.hpp>
12 # include <boost/detail/workaround.hpp>
13 
14 namespace boost { namespace python { namespace detail {
15 
16 template <class T>
17 struct is_string_literal : mpl::false_
18 {
19 };
20 
21 #  if !defined(__MWERKS__) || __MWERKS__ > 0x2407
22 template <std::size_t n>
23 struct is_string_literal<char const[n]> : mpl::true_
24 {
25 };
26 
27 #   if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590040)) \
28   || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730)
29 // This compiler mistakenly gets the type of string literals as char*
30 // instead of char[NN].
31 template <>
32 struct is_string_literal<char* const> : mpl::true_
33 {
34 };
35 #   endif
36 
37 #  else
38 
39 // CWPro7 has trouble with the array type deduction above
40 template <class T, std::size_t n>
41 struct is_string_literal<T[n]>
42     : is_same<T, char const>
43 {
44 };
45 #  endif
46 
47 }}} // namespace boost::python::detail
48 
49 #endif // STRING_LITERAL_DWA2002629_HPP
50