This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Use deleted functions to make std::locale::facet non-copyable


Replace the private & unimplemented idiom with deleted functions when
available. This gives slightly better error messages (as well as
stricter conformance to the precise wording of the standard).

Tested powerpc64le-linux, committed to trunk.
commit dd256f9035b4e32f1bb53eaf82919b0b69c6c999
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri May 1 17:35:26 2015 +0100

    	* include/bits/locale_classes.h (locale::facet): Delete copy
    	operations in C++11 mode.

diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h
index f3898eb..7e098e3 100644
--- a/libstdc++-v3/include/bits/locale_classes.h
+++ b/libstdc++-v3/include/bits/locale_classes.h
@@ -428,6 +428,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     _GLIBCXX_CONST static const char*
     _S_get_c_name() throw();
 
+#if __cplusplus < 201103L
+  private:
+    facet(const facet&);  // Not defined.
+
+    facet&
+    operator=(const facet&);  // Not defined.
+#else
+    facet(const facet&) = delete;
+
+    facet&
+    operator=(const facet&) = delete;
+#endif
+
   private:
     void
     _M_add_reference() const throw()
@@ -448,11 +461,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	}
     }
 
-    facet(const facet&);  // Not defined.
-
-    facet&
-    operator=(const facet&);  // Not defined.
-
     class __shim;
 
     const facet* _M_sso_shim(const id*) const;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]