[glibmm/glibmm-2-66] Declare some copy constructors =default
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/glibmm-2-66] Declare some copy constructors =default
- Date: Tue, 15 Feb 2022 12:15:25 +0000 (UTC)
commit 94ab1e5359f3bd9eb8204aadea88e08f52a291d8
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Tue Feb 15 12:59:22 2022 +0100
Declare some copy constructors =default
Avoid warnings from the clang++ compiler.
It's deprecated to implicitly declare a copy constructor, if there
is a user-defined or user-deleted (=delete) copy assignment operator.
gio/giomm/socketsource.h | 1 +
glib/glibmm/main.h | 4 ++++
glib/glibmm/signalproxy.h | 1 +
glib/glibmm/ustring.h | 16 +++++++++-------
4 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/gio/giomm/socketsource.h b/gio/giomm/socketsource.h
index 0c507a56..a9046df5 100644
--- a/gio/giomm/socketsource.h
+++ b/gio/giomm/socketsource.h
@@ -35,6 +35,7 @@ class GIOMM_API SignalSocket
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
explicit inline SignalSocket(GMainContext* context);
+ SignalSocket(const SignalSocket& other) = default;
#endif
/** Connects an I/O handler that watches a socket.
diff --git a/glib/glibmm/main.h b/glib/glibmm/main.h
index c3bd7829..ca40dc37 100644
--- a/glib/glibmm/main.h
+++ b/glib/glibmm/main.h
@@ -84,6 +84,7 @@ class GLIBMM_API SignalTimeout
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
explicit inline SignalTimeout(GMainContext* context);
+ SignalTimeout(const SignalTimeout& other) = default;
#endif
/** Connects a timeout handler.
@@ -220,6 +221,7 @@ class GLIBMM_API SignalIdle
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
explicit inline SignalIdle(GMainContext* context);
+ SignalIdle(const SignalIdle& other) = default;
#endif
/** Connects an idle handler.
@@ -278,6 +280,7 @@ class GLIBMM_API SignalIO
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
explicit inline SignalIO(GMainContext* context);
+ SignalIO(const SignalIO& other) = default;
#endif
/** Connects an I/O handler that watches a file descriptor.
@@ -349,6 +352,7 @@ class GLIBMM_API SignalChildWatch
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
explicit inline SignalChildWatch(GMainContext* context);
+ SignalChildWatch(const SignalChildWatch& other) = default;
#endif
/** Connects a child watch handler.
* @code
diff --git a/glib/glibmm/signalproxy.h b/glib/glibmm/signalproxy.h
index 0a94e849..82387b5b 100644
--- a/glib/glibmm/signalproxy.h
+++ b/glib/glibmm/signalproxy.h
@@ -51,6 +51,7 @@ class GLIBMM_API SignalProxyBase
{
public:
SignalProxyBase(Glib::ObjectBase* obj);
+ SignalProxyBase(const SignalProxyBase& other) = default;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static inline sigc::slot_base* data_to_slot(void* data)
diff --git a/glib/glibmm/ustring.h b/glib/glibmm/ustring.h
index 949789be..8746ca6e 100644
--- a/glib/glibmm/ustring.h
+++ b/glib/glibmm/ustring.h
@@ -25,6 +25,7 @@
#include <iterator>
#include <sstream>
#include <string>
+#include <type_traits> // std::enable_if, std::is_same
#ifndef GLIBMM_HAVE_STD_ITERATOR_TRAITS
#include <cstddef> /* for std::ptrdiff_t */
#endif
@@ -198,7 +199,14 @@ public:
using pointer = void;
inline ustring_Iterator();
- inline ustring_Iterator(const ustring_Iterator<std::string::iterator>& other);
+ // A std::string::iterator can be copied to a std::string::const_iterator.
+ template <typename T2, typename = typename std::enable_if<
+ std::is_same<std::string::const_iterator, T>::value &&
+ std::is_same<std::string::iterator, T2>::value, T2>::type>
+ inline ustring_Iterator(const ustring_Iterator<T2>& other)
+ : pos_(other.base())
+ { }
+ ustring_Iterator(const ustring_Iterator& other) = default;
ustring_Iterator& operator=(const ustring_Iterator& other) = default;
inline value_type operator*() const;
@@ -1161,12 +1169,6 @@ inline ustring_Iterator<T>::ustring_Iterator() : pos_()
{
}
-template <class T>
-inline ustring_Iterator<T>::ustring_Iterator(const ustring_Iterator<std::string::iterator>& other)
-: pos_(other.base())
-{
-}
-
template <class T>
inline typename ustring_Iterator<T>::value_type ustring_Iterator<T>::operator*() const
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]