Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_corelib_text_qanystringview.cpp
Go to the documentation of this file.
1
// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4
#
include
<
QAnyStringView
>
5
6
//! [0]
7
void
myfun1
(QAnyStringView sv);
// preferred
8
void
myfun2
(
const
QAnyStringView &sv);
// compiles and works, but slower
9
//! [0]
10
11
void
examples
()
12
{
13
char
array[] =
"Hello, world!"
;
14
15
//! [2]
16
auto
sv1 = QAnyStringView{std::begin(array), std::end(array) - 1};
// using C++11 std::begin()/std::end()
17
auto
sv2 = QAnyStringView(array, std::size(array) - 1);
// using C++17 std::size()
18
//! [2]
19
}
examples
bool examples()
[3]
Definition
src_corelib_global_qglobal.cpp:43
myfun1
void myfun1(QAnyStringView sv)
[0]
myfun2
void myfun2(const QAnyStringView &sv)
qtbase
src
corelib
doc
snippets
code
src_corelib_text_qanystringview.cpp
Generated on
for Qt by
1.14.0