std::wmemchr
cppreference.com
<tbody>
</tbody>
const wchar_t* wmemchr( const wchar_t* ptr, wchar_t ch, std::size_t count ); |
(1) | |
wchar_t* wmemchr( wchar_t* ptr, wchar_t ch, std::size_t count ); |
(2) | |
ch count , ptr.
count , .
| ptr | , | |
| ch | ||
| count |
, .
#include <clocale>
#include <cwchar>
#include <iostream>
#include <locale>
int main()
{
const wchar_t str[] = L"\0";
wchar_t target = L'';
const std::size_t sz = sizeof str / sizeof *str;
if (const wchar_t* result = std::wmemchr(str, target, sz))
{
std::setlocale(LC_ALL, "en_US.utf8");
std::wcout.imbue(std::locale("en_US.utf8"));
std::wcout << L" '" << target << L"' " << result - str << '\n';
}
}
:
'' 14
| () | |
| () | |
| () | |
(C++11) |
, ( ) |
C wmemchr
| |