Boost C++ Libraries: Ticket #13231: u32regex_replace() for std::u32string (UTF-32) won't compile https://svn.boost.org/trac10/ticket/13231 <p> Note - This pertains to input UTF-32 strings. </p> <p> Compiler: VS2015 , VC++ Boost version: 1.64 </p> <p> The u32regex_search() works fine and as expected </p> <p> ================================= </p> <p> Problem description: Intellisence detects proper input<br /> parameters using the u32string parameter, but throws many<br /> errors when compiling. </p> <p> The errors start with<br /> </p> <blockquote class="citation"> <p> 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'<br /> </p> </blockquote> <p> and end with<br /> </p> <blockquote class="citation"> <blockquote> <p> <a class="missing wiki">RxReplace</a>.cpp(9255): note: see reference to function template instantiation 'std::basic_string&lt;char32_t,std::char_traits&lt;char32_t&gt;,std::allocator&lt;char32_t&gt;&gt; boost::u32regex_replace&lt;char32_t&gt;(const std::basic_string&lt;char32_t,std::char_traits&lt;char32_t&gt;,std::allocator&lt;char32_t&gt;&gt; &amp;,const boost::u32regex &amp;,const std::basic_string&lt;char32_t,std::char_traits&lt;char32_t&gt;,std::allocator&lt;char32_t&gt;&gt; &amp;,boost::regex_constants::match_flag_type)' being compiled </p> </blockquote> </blockquote> <p> with about 20 errors in between. <br /> </p> <p> I hope this is just a problem with extensions.hpp<br /> and maybe there is a quick fix (or it has already been fixed).<br /> I desperately need this to work with <em>std::u32string</em> types<br /> as <a class="missing wiki">UnicodeString</a> just won't cut it for my purposes. </p> <p> <em>From the documentation:<br /> u32regex_replace<br /> <br /> For each regex_replace algorithm defined by<br /> &lt;boost/regex.hpp&gt;, then &lt;boost/regex/icu.hpp&gt; 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 <a class="missing wiki">UnicodeString</a> as input. </em> </p> <p> The code below reproduces the compile errors </p> <pre class="wiki"> // 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 ); // &lt;-- 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 ) ) { // ... } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13231 Trac 1.4.3 anonymous Wed, 27 Sep 2017 23:43:53 GMT component changed; owner set https://svn.boost.org/trac10/ticket/13231#comment:1 https://svn.boost.org/trac10/ticket/13231#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">John Maddock</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">regex</span> </li> </ul> Ticket anonymous Wed, 27 Sep 2017 23:45:27 GMT severity changed https://svn.boost.org/trac10/ticket/13231#comment:2 https://svn.boost.org/trac10/ticket/13231#comment:2 <ul> <li><strong>severity</strong> <span class="trac-field-old">Problem</span> → <span class="trac-field-new">Showstopper</span> </li> </ul> Ticket robic@… Thu, 28 Sep 2017 20:46:16 GMT <link>https://svn.boost.org/trac10/ticket/13231#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13231#comment:3</guid> <description> <p> This looks to be fixed in release 1.65.1 </p> <p> I've tested the above code with this release and it works fine. </p> <p> Details where it was fixed: </p> <pre class="wiki">Chapter 15. Boost.Functional/Hash Change log: Boost 1.65.0 • Support for char16_t, char32_t, u16string, u32string ------------------------------------------------------- boost_1_65_1\boost\functional\hash\hash.hpp BOOST_HASH_SPECIALIZE(char16_t) BOOST_HASH_SPECIALIZE(char32_t) BOOST_HASH_SPECIALIZE_REF(std::basic_string&lt;char16_t&gt;) BOOST_HASH_SPECIALIZE_REF(std::basic_string&lt;char32_t&gt;) </pre> </description> <category>Ticket</category> </item> </channel> </rss>