1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 13:21:47 +02:00

CanonPath: Add rel_c_str()

Defensively because isRoot() is also defensive.
This commit is contained in:
Robert Hensing 2024-01-12 22:55:37 +01:00
parent 274d887fee
commit 15f7bdaf27
2 changed files with 8 additions and 2 deletions

View file

@ -88,6 +88,13 @@ public:
std::string_view rel() const
{ return ((std::string_view) path).substr(1); }
const char * rel_c_str() const
{
auto cs = path.c_str();
assert(cs[0]); // for safety if invariant is broken
return &cs[1];
}
struct Iterator
{
std::string_view remaining;