[cfe-commits] [PATCH] share code between StringRef and ArrayRef

Benjamin Kramer benny.kra at googlemail.com
Thu Apr 14 05:35:08 PDT 2011



On 14.04.2011, at 09:56, Jay Foad <jay.foad at gmail.com> wrote:

> This patch removes a bit of code from StringRef by making it derive
> from ArrayRef<char>.
> 
> Comments? OK to commit? The savings aren't huge, so I'm not
> particularly wedded to the patch.

Hi Jay,

Have you checked the compile time impact of this? StringRef.h is included everywhere and ArrayRef.h pulls in Smallvector and Vector which are both big headers. I don't think this is worth it.


> 
> Incidentally, I didn't touch StringRef::front(), back() or
> operator[](), because they return char, whereas the ArrayRef<char>
> implementations would return const char &. My C++ isn't good enough to
> work out whether that's an important difference or not.
> 
> ArrayRef.h  |    2 +-
> StringRef.h |   39 +++++++--------------------------------
> 2 files changed, 8 insertions(+), 33 deletions(-)
> 
> Thanks,
> Jay.
> <stringref.diff>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list