Reference-counted string. This class just adds the StringPiece constructor. More...
#include "shared_string.h"
Public Member Functions | |
SharedString (const StringPiece &str) | |
SharedString (const GoogleString &str) | |
SharedString (const char *str) |
Reference-counted string. This class just adds the StringPiece constructor.
net_instaweb::SharedString::SharedString | ( | const GoogleString & | str | ) | [inline, explicit] |
When constructing with a GoogleString, we going through the StringPiece ctor above causes an extra copy compared with string implementations that use copy-on-write.
net_instaweb::SharedString::SharedString | ( | const char * | str | ) | [inline, explicit] |
Given the two constructors above, it is ambiguous which one gets called when passed a string-literal, so making an explicit const char* constructor eliminates the ambiguity. This is likely beneficial mostly for tests.