[Boost-bugs] [Boost C++ Libraries] #13231: u32regex_replace() for std::u32string (UTF-32) won't compile

Subject: [Boost-bugs] [Boost C++ Libraries] #13231: u32regex_replace() for std::u32string (UTF-32) won't compile
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-09-27 23:24:52

#13231: u32regex_replace() for std::u32string (UTF-32) won't compile
 Reporter: robic@… | Owner: (none)
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: None
  Version: Boost 1.64.0 | Severity: Problem
 Keywords: |
 Note - This pertains to input UTF-32 strings.

 Compiler: VS2015 , VC++
 Boost version: 1.64

 The u32regex_search() works fine and as expected


 Problem description: Intellisence detects proper input\\ parameters
 using the u32string parameter, but throws many\\
 errors when compiling.

 The errors start with\\

>boost_1_64_0\boost/functional/hash/extensions.hpp(262): error C2664:
 'size_t boost::hash_value(std::type_index)': cannot convert argument 1
 from 'const char32_t' to 'std::type_index'\\

 and end with\\

> RxReplace.cpp(9255): note: see reference to function template
 &,const boost::u32regex &,const
 &,boost::regex_constants::match_flag_type)' being compiled

 with about 20 errors in between. \\

 I hope this is just a problem with extensions.hpp\\
 and maybe there is a quick fix (or it has already been fixed).\\
 I desperately need this to work with ''std::u32string'' types\\
 as UnicodeString just won't cut it for my purposes.

 ''From the documentation:\\
 For each regex_replace algorithm defined by\\
 <boost/regex.hpp>, then <boost/regex/icu.hpp> defines an
 overloaded algorithm that takes the same arguments, but
 which is called u32regex_replace, and which will accept
 UTF-8, UTF-16 or UTF-32 encoded data, as well as an ICU
 UnicodeString as input.

 The code below reproduces the compile errors

         // rxconst.h
         // ==============================

         typedef std::u32string X_32string;
         typedef std::wstring X_string;
         typedef boost::u32regex U_X_regex;
         typedef boost::u32match X_u32match;
         typedef std::u32string::const_iterator U32SITR;

         #define U_MAKEREGEX(str,options) make_u32regex(str,options)
         #define U_REGEX_SEARCH boost::u32regex_search
         #define U_REGEX_REPLACE boost::u32regex_replace

         // RxReplace.cpp ( won't compile )
         // ==============================
         #include "rxconst.h";

         U_X_regex uRx = U_MAKEREGEX( _T("[trgt]+"), regex_constants::perl
         X_32string sTarget, sFmt, sOutput;
         WstrToU32string( X_string(_T("target")), sTarget );
         WstrToU32string( X_string(_T("")), sFmt );

         sOutput = U_REGEX_REPLACE( sTarget, uRx, sFmt ); // <--
 Won't compile

         // RxSearch.cpp ( compiles and runs as expected )
         // ==============================
         #include "rxconst.h";

         U_X_regex uRx = U_MAKEREGEX( _T("[abce]+"), regex_constants::perl
         X_32string sSrc;
         WstrToU32string( X_string(_T("source")), sSrc );
         U32SITR SitrStart = sSrc.begin();
         U32SITR start = SitrStart;
         U32SITR end = sSrc.end();

         X_u32match _M;

         while ( U_REGEX_SEARCH( start, end, _M, uRx, Flags, SitrStart ) )
                 // ...

Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13231>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-09-27 23:31:03 UTC