This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[patch] Use deleted functions to make std::locale::facet non-copyable
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 1 May 2015 17:51:09 +0100
- Subject: [patch] Use deleted functions to make std::locale::facet non-copyable
- Authentication-results: sourceware.org; auth=none
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;