Describe the release item
The as_ prefix supposes that the returned value still references to the original owner. E.g. KeyExpr::as_string_view is completely correct as the string view is just a refernence to value which contained in KeyExpt. On the other hand the to_ prefix supposes transferring the ownership. E.g. Config::to_string() creates new std::string object.
So normally the as_string and as_vector should be to_string and to_vector.
The proposal is:
- add methods
to_string and to_vector to Bytes
- keep
as_string and as_vector as the API is already stabilized, but mark them as deprecated and remove them from the documentation
- do all necessary renaming in the examples/tests
Describe the release item
The
as_prefix supposes that the returned value still references to the original owner. E.g.KeyExpr::as_string_viewis completely correct as the string view is just a refernence to value which contained in KeyExpt. On the other hand theto_prefix supposes transferring the ownership. E.g.Config::to_string()creates newstd::stringobject.So normally the
as_stringandas_vectorshould beto_stringandto_vector.The proposal is:
to_stringandto_vectortoBytesas_stringandas_vectoras the API is already stabilized, but mark them as deprecated and remove them from the documentation