Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/regex/test/concepts/concept_check.cpp @ 13

Last change on this file since 13 was 12, checked in by landauf, 18 years ago

added boost

File size: 2.9 KB
Line 
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
12#include <boost/config.hpp>
13
14#if defined(BOOST_MSVC)
15// this lets us compile at warning level 4 without seeing concept-check related warnings
16#  pragma warning(disable:4100)
17#endif
18#ifdef __BORLANDC__
19#pragma option -w-8019 -w-8004 -w-8008
20#endif
21#include <boost/regex.hpp>
22#include <boost/detail/workaround.hpp>
23#if !BOOST_WORKAROUND(_MSC_VER, < 1310) && !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__GNUC__, < 3)
24#include <boost/regex/concepts.hpp>
25#endif
26
27
28int main()
29{
30   // VC6 and VC7 can't cope with the iterator architypes,
31   // don't bother testing as it doesn't work:
32#if !BOOST_WORKAROUND(_MSC_VER, < 1310) && !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__GNUC__, < 3)
33   boost::function_requires<
34      boost::RegexTraitsConcept<
35         boost::regex_traits<char>
36      >
37   >();
38#ifndef BOOST_NO_STD_LOCALE
39   boost::function_requires<
40      boost::BoostRegexConcept<
41         boost::basic_regex<char, boost::cpp_regex_traits<char> >
42      >
43   >();
44#ifndef BOOST_NO_WREGEX
45   boost::function_requires<
46      boost::BoostRegexConcept<
47         boost::basic_regex<wchar_t, boost::cpp_regex_traits<wchar_t> >
48      >
49   >();
50#endif
51#endif
52#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
53   boost::function_requires<
54      boost::BoostRegexConcept<
55         boost::basic_regex<char, boost::c_regex_traits<char> >
56      >
57   >();
58#ifndef BOOST_NO_WREGEX
59   boost::function_requires<
60      boost::BoostRegexConcept<
61         boost::basic_regex<wchar_t, boost::c_regex_traits<wchar_t> >
62      >
63   >();
64#endif
65#endif
66#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
67   boost::function_requires<
68      boost::BoostRegexConcept<
69         boost::basic_regex<char, boost::w32_regex_traits<char> >
70      >
71   >();
72#ifndef BOOST_NO_WREGEX
73   boost::function_requires<
74      boost::BoostRegexConcept<
75         boost::basic_regex<wchar_t, boost::w32_regex_traits<wchar_t> >
76      >
77   >();
78#endif
79#endif
80   //
81   // now test the regex_traits concepts:
82   //
83   typedef boost::basic_regex<char, boost::regex_traits_architype<char> > regex_traits_tester_type1;
84   boost::function_requires<
85      boost::BoostRegexConcept<
86         regex_traits_tester_type1
87      >
88   >();
89#if !defined(__MWERKS__) && !defined(__SUNPRO_CC) // MWCW tries to instantiate std::basic_string<boost::char_architype>, not sure whose bug this is....
90   typedef boost::basic_regex<boost::char_architype, boost::regex_traits_architype<boost::char_architype> > regex_traits_tester_type2;
91   boost::function_requires<
92      boost::BaseRegexConcept<
93         regex_traits_tester_type2
94      >
95   >();
96#endif // __MWERKS__
97#endif   
98   return 0;
99}
100
101
Note: See TracBrowser for help on using the repository browser.