C++ Logo

SG16

Advanced search

Subject: Re: [SG16-Unicode] [isocpp-lib-ext] Proposed design change to P1030 filesystem::path_view
From: Herring, Davis (herring_at_[hidden])
Date: 2019-08-22 08:45:24


> It has been brought to my attention by Victor Zverovich that
> filesystem::path has an unfortunate quirk wrt Ranges:
> filesystem::path::iterator::value_type is filesystem::path.

This was (my) Late 19 comment for C++17. (At the time, I proposed just using string for the individual components, but it's still helpful to have path's encoding support.) It's also a famous pitfall in Python:

  def depth(x,f): # apply f to all leaves
    try: x=iter(x)
    except TypeError: f(x)
    else:
      for e in x: depth(e,f)

depth("a",id) will recurse forever because list("a")[0]=="a".

Davis


SG16 list run by sg16-owner@lists.isocpp.org