string_literal.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. # include <cstddef>
  8. # include <boost/type.hpp>
  9. # include <boost/type_traits/array_traits.hpp>
  10. # include <boost/type_traits/same_traits.hpp>
  11. # include <boost/mpl/bool.hpp>
  12. # include <boost/detail/workaround.hpp>
  13. namespace boost { namespace python { namespace detail {
  14. template <class T>
  15. struct is_string_literal : mpl::false_
  16. {
  17. };
  18. # if !defined(__MWERKS__) || __MWERKS__ > 0x2407
  19. template <std::size_t n>
  20. struct is_string_literal<char const[n]> : mpl::true_
  21. {
  22. };
  23. # if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590040)) \
  24. || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730)
  25. // This compiler mistakenly gets the type of string literals as char*
  26. // instead of char[NN].
  27. template <>
  28. struct is_string_literal<char* const> : mpl::true_
  29. {
  30. };
  31. # endif
  32. # else
  33. // CWPro7 has trouble with the array type deduction above
  34. template <class T, std::size_t n>
  35. struct is_string_literal<T[n]>
  36. : is_same<T, char const>
  37. {
  38. };
  39. # endif
  40. }}} // namespace boost::python::detail
  41. #endif // STRING_LITERAL_DWA2002629_HPP