[vlc-commits] [Git][videolan/vlc][master] medialib: use std::as_const instead of qAsConst

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Aug 1 14:18:24 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
42ddce12 by Alexandre Janniaux at 2024-08-01T13:46:46+00:00
medialib: use std::as_const instead of qAsConst

std::as_const is available starting with C++17[^1]. qAsConst is now
deprecated:

    ../../../../modules/gui/qt/medialibrary/medialib.cpp: In lambda function:
    ../../../../modules/gui/qt/medialibrary/medialib.cpp:357:39: warning: ‘constexpr typename std::add_const<_Tp>::type& qAsConst(T&) [with T = QList<QJSValue>; typename std::add_const<_Tp>::type = const QList<QJSValue>]’ is deprecated: Use std::as_const() instead. [-Wdeprecated-declarations]
      357 |         for (const auto& cb : qAsConst(it.value()))
          |                               ~~~~~~~~^~~~~~~~~~~~

[^1]: https://en.cppreference.com/w/cpp/utility/as_const

- - - - -


1 changed file:

- modules/gui/qt/medialibrary/medialib.cpp


Changes:

=====================================
modules/gui/qt/medialibrary/medialib.cpp
=====================================
@@ -21,6 +21,7 @@
 #include "playlist/playlist_controller.hpp"
 #include "util/shared_input_item.hpp"
 
+#include <utility>
 
 MediaLib::MediaLib(qt_intf_t *_intf, QObject *_parent)
     : QObject( _parent )
@@ -354,7 +355,7 @@ void MediaLib::mlInputItem(const QVector<MLItemId>& itemIdVector, QJSValue callb
             i++;
         }
 
-        for (const auto& cb : qAsConst(it.value()))
+        for (const auto& cb : std::as_const(it.value()))
         {
             cb.call({jsArray});
         }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/42ddce12aa53699228b1f6349989dea4fe8ab9b3

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/42ddce12aa53699228b1f6349989dea4fe8ab9b3
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list