This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch] libstdc++/56785 reduce space overhead of nested tuples
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Sat, 17 Jan 2015 15:59:14 +0000
- Subject: Re: [patch] libstdc++/56785 reduce space overhead of nested tuples
- Authentication-results: sourceware.org; auth=none
- References: <20150117002350 dot GN3360 at redhat dot com> <alpine dot DEB dot 2 dot 11 dot 1501170936370 dot 1558 at laptop-mg dot saclay dot inria dot fr> <CAH6eHdQrUzELT_gBuTmZvfk7bxK9PkmFqpXxrvtKmQOtbhje+Q at mail dot gmail dot com>
On 17/01/15 10:54 +0000, Jonathan Wakely wrote:
On 17 January 2015 at 08:49, Marc Glisse wrote:
What about std::rotate in a different patch though? As I understand it,
changing the return type does not affect the mangling, and if we use the new
function (and its return value) and link with older code that has the old
function, if the linker picks the old function, bad things may happen, no?
That's true. We don't need an abi_tag (that's needed for classes as
they can be used as bases or members and alter the class layout
without affecting the mangled name) but the new definition of
std::rotate should be in the inline namespace _V2 that we've used for
a few other types, so the linker won't confuse it with the old version
returning void.
So something like this.
commit 8029aeaa18171a8f1b68a49db36a1df6c0c3248d
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Sat Jan 17 14:03:46 2015 +0000
* include/bits/stl_algo.h (__rotate, rotate): Define in inline
namespace _V2.
diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index 3325b94..a8769d0 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -1237,6 +1237,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __m;
}
+ inline namespace _V2
+ {
/// This is a helper function for the rotate algorithm.
template<typename _ForwardIterator>
_ForwardIterator
@@ -1437,6 +1439,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return std::__rotate(__first, __middle, __last,
std::__iterator_category(__first));
}
+ } // namespace _V2
/**
* @brief Copy a sequence, rotating its elements.