What causes the boost: below so as not to execute the is_singular statement?

Sometimes I get strange behavior from boost :: lower when std :: wstring is called. In particular, I saw the following statement in the release build (but not in the debug build):

Assertion failed: !is_singular(), file C:\boost_1_40_0\boost/range/iterator_range.hpp, line 281 

I also saw what seems to be memory errors after calling boost :: to_lower in contexts such as:

void test(const wchar_t* word) {
    std::wstring buf(word);
    boost::to_lower(buf);
    ...
}

Replace the call boost::tolower(wstr)with std::transform(wstr.begin(), wstr.end(), wstr.begin(), towlower)to fix the problem; but I would like to know what is going wrong.

My best guess is that maybe the problem has something to do with changing the case of Unicode characters - maybe the size of the encoding of the reduced character is different from the size of the encoding of the original character?

- , ? , , "is_singular()" boost, Google .

: Boost 1.40.0; MS Visual Studio 2008.

+3
2

, .

, NDEBUG ( , ), . Boost , (, ). A , , . , B, , , ( ), .

NDEBUG .

+3

, ( , .. ). , boost to_lower , , ( undefined, , , ).

Heisenbugs.

+3

Source: https://habr.com/ru/post/1781538/


All Articles