diff options
author | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2022-02-15 12:59:22 +0100 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2022-02-15 12:59:22 +0100 |
commit | 94ab1e5359f3bd9eb8204aadea88e08f52a291d8 (patch) | |
tree | 00c435cabbb65d70b4d4fb5a3856b19ac89967d5 | |
parent | eab7571e48dc8bc303def8db144f8debd1a19134 (diff) | |
download | glibmm-94ab1e5359f3bd9eb8204aadea88e08f52a291d8.tar.gz |
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.
-rw-r--r-- | gio/giomm/socketsource.h | 1 | ||||
-rw-r--r-- | glib/glibmm/main.h | 4 | ||||
-rw-r--r-- | glib/glibmm/signalproxy.h | 1 | ||||
-rw-r--r-- | 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; @@ -1162,12 +1170,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 { return Glib::get_unichar_from_std_iterator(pos_); |