2003-07-11 11:51:35 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright (c) 2003
|
|
|
|
* Dr John Maddock
|
|
|
|
*
|
2003-10-04 11:29:20 +00:00
|
|
|
* Use, modification and distribution are subject to the
|
2003-09-30 13:02:51 +00:00
|
|
|
* Boost Software License, Version 1.0. (See accompanying file
|
|
|
|
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
2003-07-11 11:51:35 +00:00
|
|
|
*
|
|
|
|
*/
|
2003-06-27 11:11:21 +00:00
|
|
|
|
2003-08-12 11:24:09 +00:00
|
|
|
|
2003-06-27 11:11:21 +00:00
|
|
|
#include <boost/regex.hpp>
|
|
|
|
#include <boost/concept_archetype.hpp>
|
2003-08-12 11:24:09 +00:00
|
|
|
#if defined(BOOST_MSVC)
|
|
|
|
// this lets us compile at warning level 4 without seeing concept-check related warnings
|
|
|
|
# pragma warning(disable:4100)
|
|
|
|
#endif
|
2003-06-27 11:11:21 +00:00
|
|
|
#include <boost/concept_check.hpp>
|
2003-07-11 11:51:35 +00:00
|
|
|
#include <boost/detail/workaround.hpp>
|
2003-06-27 11:11:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2003-07-11 11:51:35 +00:00
|
|
|
// VC6 and VC7 can't cope with the iterator architypes,
|
|
|
|
// don't bother testing as it doesn't work:
|
2003-08-12 12:03:25 +00:00
|
|
|
#if !BOOST_WORKAROUND(_MSC_VER, < 1310)
|
2003-06-27 11:11:21 +00:00
|
|
|
typedef boost::bidirectional_iterator_archetype<char> iterator_type;
|
2003-09-30 11:41:40 +00:00
|
|
|
typedef boost::input_iterator_archetype<char> input_iterator_type;
|
|
|
|
input_iterator_type i, j;
|
|
|
|
#if!defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
|
|
|
|
boost::regex r(i, j);
|
|
|
|
r.assign(i, j);
|
|
|
|
#else
|
2003-06-27 11:11:21 +00:00
|
|
|
boost::regex r;
|
2003-09-30 11:41:40 +00:00
|
|
|
#endif
|
2003-06-27 11:11:21 +00:00
|
|
|
iterator_type a, b;
|
|
|
|
boost::detail::dummy_constructor dummy;
|
|
|
|
boost::output_iterator_archetype<char> out(dummy);
|
|
|
|
std::string s;
|
|
|
|
boost::match_results<iterator_type> what;
|
|
|
|
|
|
|
|
boost::regex_match(a, b, r);
|
|
|
|
boost::regex_match(a, b, what, r);
|
|
|
|
boost::regex_search(a, b, r);
|
|
|
|
boost::regex_search(a, b, what, r);
|
|
|
|
out = boost::regex_replace(out, a, b, r, s, boost::match_default);
|
|
|
|
s = boost::regex_replace(s, r, s, boost::match_default);
|
|
|
|
|
|
|
|
out = what.format(out, s, boost::format_default);
|
|
|
|
s = what.format(s, boost::format_default);
|
|
|
|
|
|
|
|
boost::function_requires<
|
|
|
|
boost::ForwardIteratorConcept<
|
|
|
|
boost::regex_iterator<iterator_type>
|
|
|
|
>
|
|
|
|
>();
|
2003-07-11 11:51:35 +00:00
|
|
|
// this fails with glibc++v2 :
|
|
|
|
#if !BOOST_WORKAROUND(__GNUC__, < 3) && !BOOST_WORKAROUND(BOOST_MSVC, <1300)
|
2003-06-27 11:11:21 +00:00
|
|
|
boost::function_requires<
|
|
|
|
boost::ForwardIteratorConcept<
|
|
|
|
boost::regex_token_iterator<iterator_type>
|
|
|
|
>
|
|
|
|
>();
|
2003-07-11 11:51:35 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
return 0;
|
2003-06-27 11:11:21 +00:00
|
|
|
}
|
2003-07-11 11:51:35 +00:00
|
|
|
|
2003-09-30 13:02:51 +00:00
|
|
|
|