C++ Logo


Advanced search

Re: [SG16-Unicode] [isocpp-lib-ext] Proposed design change to P1030 filesystem::path_view

From: Herring, Davis <herring_at_[hidden]>
Date: Thu, 22 Aug 2019 13:45:24 +0000
> 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)
      for e in x: depth(e,f)

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


Received on 2019-08-22 15:45:38