42907ca9a4
The class template semiregular-box<T> defined in [range.semi.wrap] is used by a number of views to accomodate non-semiregular subobjects while ensuring that the overall view remains semiregular. It provides a stand-in default constructor, copy assignment operator and move assignment operator whenever the underlying type lacks them. The wrapper derives from std::optional<T> to support default construction when T is not default constructible. It would be nice for this wrapper to essentially be a no-op when the underlying type is already semiregular, but this is currently not the case due to its use of std::optional<T>, which incurs space overhead compared to storing just T. To that end, this patch specializes the semiregular wrapper for semiregular T. Compared to the primary template, this specialization uses less space, and it allows [[no_unique_address]] to optimize away wrapped data members whose underlying type is empty and semiregular (e.g. a non-capturing lambda). This patch also applies [[no_unique_address]] to the five data members that use the wrapper. libstdc++-v3/ChangeLog: * include/std/ranges (__detail::__boxable): Split out the associated constraints of __box into here. (__detail::__box): Use the __boxable concept. Define a leaner partial specialization for semiregular types. (single_view::_M_value): Give it [[no_unique_address]]. (filter_view::_M_pred): Likewise. (transform_view::_M_fun): Likewise. (take_while_view::_M_pred): Likewise. (drop_while_view::_M_pred):: Likewise. * testsuite/std/ranges/adaptors/detail/semiregular_box.cc: New test. |
||
---|---|---|
.. | ||
config | ||
doc | ||
include | ||
libsupc++ | ||
po | ||
python | ||
scripts | ||
src | ||
testsuite | ||
acinclude.m4 | ||
aclocal.m4 | ||
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 | ||
config.h.in | ||
configure | ||
configure.ac | ||
configure.host | ||
crossconfig.m4 | ||
fragment.am | ||
linkage.m4 | ||
Makefile.am | ||
Makefile.in | ||
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.