This is the mail archive of the
mailing list for the GCC project.
Re: std::get not returning const rvalue reference from const rvalue reference of tuple
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Tim <tolez_xuninada at hotmail dot com>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 9 May 2018 23:14:00 +0100
- Subject: Re: std::get not returning const rvalue reference from const rvalue reference of tuple
- References: <email@example.com>
On 9 May 2018 at 22:10, Tim wrote:
> but I was expecting the last line of output to be "double const&&" because
> the following overload of std::get:
> template< std::size_t I, class... Types >
> constexpr std::tuple_element_t<I, tuple<Types...> >const&&
> get( const tuple<Types...>&& t ) noexcept;
> What am I missing here? I'm using gcc 7.3.0 and the above code is compiled
> using "-std=c++17"
The overload you show above was only added to the standard quite
recently, and is not implemented in GCC 7.3 (nobody ever claimed that
C++17 support is complete in GCC 7.3).
It was added by https://cplusplus.github.io/LWG/issue2485
If you use GCC 8.1 you get the result you expect.