Date: Wed, 07 Dec 2022 11:22:43 +0000
Hi,
This just forwards. I don't think that there is anything inherently wrong or incorrect with a const rvalue, other than being mostly useless. Conceptually an expiring const object absolutely makes sense, although normally you can't make much more use of it than with a const lvalue.
No harm in forwarding it.
Cheers,
Lénárd
On 7 December 2022 10:49:34 GMT, Yongwei Wu via Std-Discussion <std-discussion_at_[hidden]> wrote:
>I am wondering how useful is const rvalue, and I've found some good
>discussion here:
>
>https://stackoverflow.com/questions/4938875/do-rvalue-references-to-const-have-any-use
>
>A question remains unanswered: Why do we support std::get on a const
>rvalue of tuple (or variant)? Apart from the syntactic symmetry, what
>practical purpose does it serve? I.e. if one removes the following
>overload (and keeps the remaining three):
>
>template< class T, class... Types >
>constexpr const T&& get( const tuple<Types...>&& t ) noexcept;
>
>Can anything bad happen? And under which situations?
>
>Thanks in advance.
>
>Best regards,
>
>Yongwei
>
>--
>Yongwei Wu
>URL: http://wyw.dcweb.cn/
>--
>Std-Discussion mailing list
>Std-Discussion_at_[hidden]
>https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
This just forwards. I don't think that there is anything inherently wrong or incorrect with a const rvalue, other than being mostly useless. Conceptually an expiring const object absolutely makes sense, although normally you can't make much more use of it than with a const lvalue.
No harm in forwarding it.
Cheers,
Lénárd
On 7 December 2022 10:49:34 GMT, Yongwei Wu via Std-Discussion <std-discussion_at_[hidden]> wrote:
>I am wondering how useful is const rvalue, and I've found some good
>discussion here:
>
>https://stackoverflow.com/questions/4938875/do-rvalue-references-to-const-have-any-use
>
>A question remains unanswered: Why do we support std::get on a const
>rvalue of tuple (or variant)? Apart from the syntactic symmetry, what
>practical purpose does it serve? I.e. if one removes the following
>overload (and keeps the remaining three):
>
>template< class T, class... Types >
>constexpr const T&& get( const tuple<Types...>&& t ) noexcept;
>
>Can anything bad happen? And under which situations?
>
>Thanks in advance.
>
>Best regards,
>
>Yongwei
>
>--
>Yongwei Wu
>URL: http://wyw.dcweb.cn/
>--
>Std-Discussion mailing list
>Std-Discussion_at_[hidden]
>https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
Received on 2022-12-07 11:22:49