Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::OsCanonPath::Iterator Class Reference

#include <os-canon-path.hh>

Public Types

using value_type = OsFilename
using reference = const OsFilename &
using pointer = const OsFilename *
using difference_type = std::ptrdiff_t
using iterator_concept = std::bidirectional_iterator_tag
using iterator_category = std::input_iterator_tag

Public Member Functions

const OsFilename & operator* () const
const OsFilename * operator-> () const
Iterator & operator++ ()
Iterator operator++ (int)
Iterator & operator-- ()
Iterator operator-- (int)
bool operator== (const Iterator &) const =default

Friends

class OsCanonPath

Detailed Description

Iterator that yields an OsFilename for each path component.

Safe because OsCanonPath invariants guarantee every component is a valid OsFilename (no empty, ., .., or root components).

This is a "stashing" iterator: the reference returned by operator* may point into the iterator itself, so it is only valid until that iterator is advanced or destroyed. Do not hold it across ++/--, take it from a temporary iterator (*it++), or use std::reverse_iterator / std::views::reverse, which dereference a temporary copy. Copy the OsFilename if it must outlive the iterator.


The documentation for this class was generated from the following file: