mirror of git://gcc.gnu.org/git/gcc.git
![]() Hoist construction of the call wrappers out of the loop when we're repeatedly creating a call wrapper with the same bound arguments. We need to be careful about iterators that return proxy references, because bind1st(pred, *first) could bind a reference to a prvalue proxy reference returned by *first. That would then be an invalid reference by the time we invoked the call wrapper. If we dereference the iterator first and store the result of that on the stack, then we don't have a prvalue proxy reference, and can bind it (or the value it refers to) into the call wrapper: auto&& val = *first; // lifetime extension auto wrapper = bind1st(pred, val); for (;;) /* use wrapper */; This ensures that the reference returned from *first outlives the call wrapper, whether it's a proxy reference or not. For C++98 compatibility in __search we can use __decltype(expr) instead of auto&&. libstdc++-v3/ChangeLog: * include/bits/stl_algobase.h (__search, __is_permutation): Reuse predicate instead of creating a new one each time. * include/bits/stl_algo.h (__is_permutation): Likewise. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> |
||
---|---|---|
.. | ||
config | ||
doc | ||
include | ||
libsupc++ | ||
po | ||
python | ||
scripts | ||
src | ||
testsuite | ||
.editorconfig | ||
ChangeLog | ||
ChangeLog-1998 | ||
ChangeLog-1999 | ||
ChangeLog-2000 | ||
ChangeLog-2001 | ||
ChangeLog-2002 | ||
ChangeLog-2003 | ||
ChangeLog-2004 | ||
ChangeLog-2005 | ||
ChangeLog-2006 | ||
ChangeLog-2007 | ||
ChangeLog-2008 | ||
ChangeLog-2009 | ||
ChangeLog-2010 | ||
ChangeLog-2011 | ||
ChangeLog-2012 | ||
ChangeLog-2013 | ||
ChangeLog-2014 | ||
ChangeLog-2015 | ||
ChangeLog-2016 | ||
ChangeLog-2017 | ||
ChangeLog-2018 | ||
ChangeLog-2019 | ||
ChangeLog-2020 | ||
ChangeLog-2021 | ||
ChangeLog-2022 | ||
ChangeLog-2023 | ||
ChangeLog-2024 | ||
Makefile.am | ||
Makefile.in | ||
README | ||
acinclude.m4 | ||
aclocal.m4 | ||
config.h.in | ||
configure | ||
configure.ac | ||
configure.host | ||
crossconfig.m4 | ||
fragment.am | ||
linkage.m4 |
README
file: libstdc++-v3/README New users may wish to point their web browsers to the file index.html in the 'doc/html' subdirectory. It contains brief building instructions and notes on how to configure the library in interesting ways.