QScoped(Array)Pointer: remove the class-level [[nodiscard]]
It was used as a work-around for constructor-level [[nodiscard]] missing in C++17, but a) compilers are free to implement [[nodiscard]] for constructors in C++17 (P1771 was not considered a normative change, just a clarification of the existing wording), and b) prevents useful code that returns such types from functions. Pick-to: 6.6 Task-number: QTBUG-104164 Change-Id: I440b418d58e86118e84689adb06d239ca598afcc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
c823bc2fdb
commit
21c344a221
|
|
@ -67,7 +67,7 @@ typedef QScopedPointerObjectDeleteLater<QObject> QScopedPointerDeleteLater;
|
|||
#endif
|
||||
|
||||
template <typename T, typename Cleanup = QScopedPointerDeleter<T> >
|
||||
class [[nodiscard]] QScopedPointer
|
||||
class QScopedPointer
|
||||
{
|
||||
public:
|
||||
explicit QScopedPointer(T *p = nullptr) noexcept : d(p)
|
||||
|
|
@ -187,7 +187,7 @@ private:
|
|||
};
|
||||
|
||||
template <typename T, typename Cleanup = QScopedPointerArrayDeleter<T> >
|
||||
class [[nodiscard]] QScopedArrayPointer : public QScopedPointer<T, Cleanup>
|
||||
class QScopedArrayPointer : public QScopedPointer<T, Cleanup>
|
||||
{
|
||||
template <typename Ptr>
|
||||
using if_same_type = typename std::enable_if<std::is_same<typename std::remove_cv<T>::type, Ptr>::value, bool>::type;
|
||||
|
|
|
|||
Loading…
Reference in New Issue