sfinae.hpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Boost.Range library
  2. //
  3. // Copyright Thorsten Ottosen 2003-2004. Use, modification and
  4. // distribution is subject to the Boost Software License, Version
  5. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. // For more information, see http://www.boost.org/libs/range/
  9. //
  10. #ifndef BOOST_RANGE_DETAIL_SFINAE_HPP
  11. #define BOOST_RANGE_DETAIL_SFINAE_HPP
  12. #include <boost/range/config.hpp>
  13. #include <boost/type_traits/is_array.hpp>
  14. #include <boost/type_traits/detail/yes_no_type.hpp>
  15. #include <utility>
  16. namespace boost
  17. {
  18. namespace range_detail
  19. {
  20. using type_traits::yes_type;
  21. using type_traits::no_type;
  22. //////////////////////////////////////////////////////////////////////
  23. // string
  24. //////////////////////////////////////////////////////////////////////
  25. yes_type is_string_impl( const char* const );
  26. yes_type is_string_impl( const wchar_t* const );
  27. no_type is_string_impl( ... );
  28. template< std::size_t sz >
  29. yes_type is_char_array_impl( char BOOST_RANGE_ARRAY_REF()[sz] );
  30. template< std::size_t sz >
  31. yes_type is_char_array_impl( const char BOOST_RANGE_ARRAY_REF()[sz] );
  32. no_type is_char_array_impl( ... );
  33. template< std::size_t sz >
  34. yes_type is_wchar_t_array_impl( wchar_t BOOST_RANGE_ARRAY_REF()[sz] );
  35. template< std::size_t sz >
  36. yes_type is_wchar_t_array_impl( const wchar_t BOOST_RANGE_ARRAY_REF()[sz] );
  37. no_type is_wchar_t_array_impl( ... );
  38. yes_type is_char_ptr_impl( char* const );
  39. no_type is_char_ptr_impl( ... );
  40. yes_type is_const_char_ptr_impl( const char* const );
  41. no_type is_const_char_ptr_impl( ... );
  42. yes_type is_wchar_t_ptr_impl( wchar_t* const );
  43. no_type is_wchar_t_ptr_impl( ... );
  44. yes_type is_const_wchar_t_ptr_impl( const wchar_t* const );
  45. no_type is_const_wchar_t_ptr_impl( ... );
  46. //////////////////////////////////////////////////////////////////////
  47. // pair
  48. //////////////////////////////////////////////////////////////////////
  49. template< typename Iterator >
  50. yes_type is_pair_impl( const std::pair<Iterator,Iterator>* );
  51. no_type is_pair_impl( ... );
  52. //////////////////////////////////////////////////////////////////////
  53. // tags
  54. //////////////////////////////////////////////////////////////////////
  55. struct char_or_wchar_t_array_tag {};
  56. } // namespace 'range_detail'
  57. } // namespace 'boost'
  58. #endif