concept_check.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. *
  3. * Copyright (c) 2003
  4. * John Maddock
  5. *
  6. * Use, modification and distribution are subject to the
  7. * Boost Software License, Version 1.0. (See accompanying file
  8. * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. *
  10. */
  11. #include <boost/config.hpp>
  12. #if defined(BOOST_MSVC)
  13. // this lets us compile at warning level 4 without seeing concept-check related warnings
  14. # pragma warning(disable:4100)
  15. #endif
  16. #ifdef __BORLANDC__
  17. #pragma option -w-8019 -w-8004 -w-8008
  18. #endif
  19. #ifdef BOOST_INTEL
  20. #pragma warning(disable:1418 981 983 595 383)
  21. #endif
  22. #include <boost/regex.hpp>
  23. #include <boost/detail/workaround.hpp>
  24. #if !BOOST_WORKAROUND(_MSC_VER, < 1310) && !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__GNUC__, < 3)
  25. #include <boost/regex/concepts.hpp>
  26. #endif
  27. int main()
  28. {
  29. // VC6 and VC7 can't cope with the iterator architypes,
  30. // don't bother testing as it doesn't work:
  31. #if !BOOST_WORKAROUND(_MSC_VER, < 1310) && !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__GNUC__, < 3)
  32. boost::function_requires<
  33. boost::RegexTraitsConcept<
  34. boost::regex_traits<char>
  35. >
  36. >();
  37. #ifndef BOOST_NO_STD_LOCALE
  38. boost::function_requires<
  39. boost::BoostRegexConcept<
  40. boost::basic_regex<char, boost::cpp_regex_traits<char> >
  41. >
  42. >();
  43. #ifndef BOOST_NO_WREGEX
  44. boost::function_requires<
  45. boost::BoostRegexConcept<
  46. boost::basic_regex<wchar_t, boost::cpp_regex_traits<wchar_t> >
  47. >
  48. >();
  49. #endif
  50. #endif
  51. #if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
  52. boost::function_requires<
  53. boost::BoostRegexConcept<
  54. boost::basic_regex<char, boost::c_regex_traits<char> >
  55. >
  56. >();
  57. #ifndef BOOST_NO_WREGEX
  58. boost::function_requires<
  59. boost::BoostRegexConcept<
  60. boost::basic_regex<wchar_t, boost::c_regex_traits<wchar_t> >
  61. >
  62. >();
  63. #endif
  64. #endif
  65. #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
  66. boost::function_requires<
  67. boost::BoostRegexConcept<
  68. boost::basic_regex<char, boost::w32_regex_traits<char> >
  69. >
  70. >();
  71. #ifndef BOOST_NO_WREGEX
  72. boost::function_requires<
  73. boost::BoostRegexConcept<
  74. boost::basic_regex<wchar_t, boost::w32_regex_traits<wchar_t> >
  75. >
  76. >();
  77. #endif
  78. #endif
  79. //
  80. // now test the regex_traits concepts:
  81. //
  82. typedef boost::basic_regex<char, boost::regex_traits_architype<char> > regex_traits_tester_type1;
  83. boost::function_requires<
  84. boost::BoostRegexConcept<
  85. regex_traits_tester_type1
  86. >
  87. >();
  88. #if !defined(__MWERKS__) && !defined(__SUNPRO_CC) // MWCW tries to instantiate std::basic_string<boost::char_architype>, not sure whose bug this is....
  89. typedef boost::basic_regex<boost::char_architype, boost::regex_traits_architype<boost::char_architype> > regex_traits_tester_type2;
  90. boost::function_requires<
  91. boost::BaseRegexConcept<
  92. regex_traits_tester_type2
  93. >
  94. >();
  95. #endif // __MWERKS__
  96. #endif
  97. return 0;
  98. }