std::get not returning const rvalue reference from const rvalue reference of tuple

Jonathan Wakely jwakely.gcc@gmail.com
Wed May 9 22:14:00 GMT 2018


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.



More information about the Gcc-help mailing list