From bbe7570ddcc6fcce707a355b76d2d0024c44ea38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 14 Sep 2020 15:26:49 +0200 Subject: QByteArrayView: move array size deduction feature to fromArray 1. Make the ctor unable to construct a QByteArrayView from array literals other than 'char'. With the new behavior it would either be (very likely) unintended to pass e.g. a std::byte array to the ctor. And it would be confusing because you would get different sizes based on signed-ness. 2. Introduce fromArray Only supports array literals. Constructs a view of the full size. Explicit so it shouldn't be surprising. Change-Id: Ifdb55eb21057dfe7053b2561bd81e2c9825e9bc6 Reviewed-by: Andrei Golubev Reviewed-by: Sona Kurazyan Reviewed-by: Edward Welbourne --- src/corelib/doc/snippets/code/src_corelib_text_qbytearrayview.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/corelib/doc') diff --git a/src/corelib/doc/snippets/code/src_corelib_text_qbytearrayview.cpp b/src/corelib/doc/snippets/code/src_corelib_text_qbytearrayview.cpp index 31a2107c62..d70caa2650 100644 --- a/src/corelib/doc/snippets/code/src_corelib_text_qbytearrayview.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_text_qbytearrayview.cpp @@ -58,10 +58,3 @@ void fun(QByteArrayView bv); void fun(char ch) { fun(QByteArrayView(&ch, 1)); } //! [1] - -void wrapper() { - const char array[1] = { 0 }; -//! [2] - auto bv = QByteArrayView(array, std::size(array)); // using C++17 std::size() -//! [2] -} -- cgit v1.2.3