[cfe-dev] [libc++] Could we remove all support for building in a mode without R-value references from C++11 library components?

Howard Hinnant hhinnant at apple.com
Tue May 8 07:00:49 PDT 2012


On May 8, 2012, at 1:33 AM, Chandler Carruth wrote:

> I happen to be looking at <future>, and it is needlessly complicated by a great deal of code to support working in a compilation mode without r-value references. Clang and GCC both support r-value references, and this header is a C++11-only header to begin with, so it seems that the need for this has past. Could we remove it to simplify large parts of libc++? Would it have any negative effects on the ABI? (I assume not on the latter, or at least, switching it off should already have had the ABI effect, so that ship has sailed....)

For <future>, yes, we can remove the #ifdef's for non-rvalue-ref support.  <future> has never worked in C++03 mode.  I tried to get it working at first, but gave up about the time I decided it needed variadic templates.  There will be no ABI fall-out.

However there are still large parts of libc++ that technically are C++11 that I want to work in C++03 mode.  Specifically shared_ptr, the unordered containers, forward_list, most of type_traits, random, regex, etc, etc.  This is this way to aid our customers in a transition from C++03 to C++11.  They can start using some C++11 library features without being forced to switch on C++11.  Those C++11 library features that are particularly difficult and/or messy to implement will require C++11 compiler support though (typically anything requiring variadics).

Some day I would like to jettison C++03 support completely from libc++.  But not today.  Not tomorrow.  Our customers are just beginning their transition.

Howard




More information about the cfe-dev mailing list