Closed Weeena closed 7 years ago
I had the following problem: I wanted to write something like this
THROW("Unexpected type: " + class.name());
Alas, that did not compile because name() returns a string_view and string_view does not support the required operator+. As a workaround, I can write
name()
string_view
operator+
THROW("Unexpected type: " + std::string(class.name()));
but, to be honest, I dont like that very much (and I guess it causes an extra copy).
Since internally, Class stores its name as an Id (which is identical to std::string), I suggest to replace the current
Class
Id
std::string
IdRef name() const;
with
const Id& name() const;
Advantage: No unnecessary restrictions are caused.
That makes sense.
In master.
I had the following problem: I wanted to write something like this
Alas, that did not compile because
name()
returns astring_view
andstring_view
does not support the requiredoperator+
. As a workaround, I can writebut, to be honest, I dont like that very much (and I guess it causes an extra copy).
Since internally,
Class
stores its name as anId
(which is identical tostd::string
), I suggest to replace the currentwith
Advantage: No unnecessary restrictions are caused.