r275202 - in /branches/gcc-8-branch/libstdc++-v...

redi@gcc.gnu.org redi@gcc.gnu.org
Fri Aug 30 16:12:00 GMT 2019


Author: redi
Date: Fri Aug 30 16:12:37 2019
New Revision: 275202

URL: https://gcc.gnu.org/viewcvs?rev=275202&root=gcc&view=rev
Log:
Avoid redundant runtime checks in std::visit

Calling std::get will check some static assertions and also do a runtime
check for a valid index before calling __detail::__variant::__get. The
std::visit function already handles the case where any variant has an
invalid index, so __get can be used directly in __visit_invoke.

Backport from mainline
2018-10-02  Jonathan Wakely  <jwakely@redhat.com>

	* include/std/variant (__gen_vtable_impl::__visit_invoke): Call __get
	directly instead of get, as caller ensures correct index is used.
	(holds_alternative, get, get_if): Remove redundant inline specifiers.
	(_VARIANT_RELATION_FUNCTION_TEMPLATE): Likewise.

Modified:
    branches/gcc-8-branch/libstdc++-v3/ChangeLog
    branches/gcc-8-branch/libstdc++-v3/include/std/variant



More information about the Libstdc++-cvs mailing list