diff --git a/include/boost/regex/v4/u32regex_iterator.hpp b/include/boost/regex/v4/u32regex_iterator.hpp index df697521..f8763a8d 100644 --- a/include/boost/regex/v4/u32regex_iterator.hpp +++ b/include/boost/regex/v4/u32regex_iterator.hpp @@ -158,7 +158,7 @@ inline u32regex_iterator make_u32regex_iterator(const wchar_t* p return u32regex_iterator(p, p+std::wcslen(p), e, m); } #endif -#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) +#if !defined(BOOST_REGEX_UCHAR_IS_WCHAR_T) inline u32regex_iterator make_u32regex_iterator(const UChar* p, const u32regex& e, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_iterator(p, p+u_strlen(p), e, m); diff --git a/include/boost/regex/v4/u32regex_token_iterator.hpp b/include/boost/regex/v4/u32regex_token_iterator.hpp index a056102c..952f7c41 100644 --- a/include/boost/regex/v4/u32regex_token_iterator.hpp +++ b/include/boost/regex/v4/u32regex_token_iterator.hpp @@ -267,7 +267,7 @@ inline u32regex_token_iterator make_u32regex_token_iterator(cons return u32regex_token_iterator(p, p+std::wcslen(p), e, submatch, m); } #endif -#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) +#if !defined(BOOST_REGEX_UCHAR_IS_WCHAR_T) inline u32regex_token_iterator make_u32regex_token_iterator(const UChar* p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator(p, p+u_strlen(p), e, submatch, m); @@ -297,7 +297,7 @@ inline u32regex_token_iterator make_u32regex_token_iterator(cons return u32regex_token_iterator(p, p+std::wcslen(p), e, submatch, m); } #endif -#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) +#if !defined(BOOST_REGEX_UCHAR_IS_WCHAR_T) template inline u32regex_token_iterator make_u32regex_token_iterator(const UChar* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default) { diff --git a/test/concepts/icu_concept_check.cpp b/test/concepts/icu_concept_check.cpp index 3c1363eb..a55bb387 100644 --- a/test/concepts/icu_concept_check.cpp +++ b/test/concepts/icu_concept_check.cpp @@ -33,7 +33,34 @@ #include #endif +template +void check_token_iterator(I i) +{ + typedef typename I::value_type value_type; + typedef typename value_type::value_type char_type; + typedef std::basic_string string_type; + I j; + + std::vector v; + + while (i != j) + { + v.push_back(i->str()); + ++i; + } + +} + +template +void check_iterator(I i) +{ + typedef typename I::value_type value_type; + + std::vector v(i, I()); + (void)v; + +} int main() { // VC6 and VC7 can't cope with the iterator architypes, @@ -150,6 +177,64 @@ int main() s1 = boost::u32regex_replace(s1, e1, s1); s2 = boost::u32regex_replace(s2, e1, s2); + std::vector subs1; + int subs2[2] = { 1, 2 }; + + check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, 0, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, 0)); + check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1)); + check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, 0, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, 0)); + check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1)); + check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, 0, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, 0)); + check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1)); + check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, 0, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, 0)); + check_token_iterator(boost::make_u32regex_token_iterator(s1, e1)); + check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, 0, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, 0)); + check_token_iterator(boost::make_u32regex_token_iterator(s2, e1)); + check_token_iterator(boost::make_u32regex_token_iterator(us, e1, 0, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator(us, e1, 0)); + check_token_iterator(boost::make_u32regex_token_iterator(us, e1)); + + check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, subs2, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, subs2)); + check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, subs2, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, subs2)); + check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, subs2, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, subs2)); + check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, subs2, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, subs2)); + check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, subs2, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, subs2)); + check_token_iterator(boost::make_u32regex_token_iterator(us, e1, subs2, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator(us, e1, subs2)); + + check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, subs1, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator((const char*)(pb), e1, subs1)); + check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, subs1, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator((const UChar*)(pb), e1, subs1)); + check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, subs1, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator((const wchar_t*)(pb), e1, subs1)); + check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, subs1, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator(s1, e1, subs1)); + check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, subs1, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator(s2, e1, subs1)); + check_token_iterator(boost::make_u32regex_token_iterator(us, e1, subs1, boost::regex_constants::match_default)); + check_token_iterator(boost::make_u32regex_token_iterator(us, e1, subs1)); + + check_iterator(boost::make_u32regex_iterator((const char*)(pb), e1, boost::regex_constants::match_default)); + check_iterator(boost::make_u32regex_iterator((const char*)(pb), e1)); + check_iterator(boost::make_u32regex_iterator((const UChar*)(pb), e1, boost::regex_constants::match_default)); + check_iterator(boost::make_u32regex_iterator((const UChar*)(pb), e1)); + check_iterator(boost::make_u32regex_iterator((const wchar_t*)(pb), e1, boost::regex_constants::match_default)); + check_iterator(boost::make_u32regex_iterator((const wchar_t*)(pb), e1)); + check_iterator(boost::make_u32regex_iterator(s1, e1, boost::regex_constants::match_default)); + check_iterator(boost::make_u32regex_iterator(s2, e1)); + check_iterator(boost::make_u32regex_iterator(us, e1)); + #endif return 0; }