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]
7void myfun1(QAnyStringView sv); // preferred
8void myfun2(const QAnyStringView &sv); // compiles and works, but slower
9//! [0]
10
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}
bool examples()
[3]
void myfun1(QAnyStringView sv)
[0]
void myfun2(const QAnyStringView &sv)