folly: File explicit ctor
[folly.git] / folly / experimental / FileGen-inl.h
index 79f8a1dde4e4b9ca67146cd8d68415f5bf1ce492..c3a7f94bf7f5a0f47ccf0cba80a99ebdb27b9891 100644 (file)
@@ -121,6 +121,7 @@ class FileWriter : public Operator<FileWriter> {
 };
 
 }  // !detail
+
 /**
  * Generator which reads lines from a file.
  * Note: This produces StringPieces which reference temporary strings which are
@@ -135,4 +136,10 @@ inline auto byLine(File file, char delim = '\n')
        | resplit(delim);
 }
 
+inline auto byLine(int fd, char delim = '\n')
+  -> decltype(byLine(File(fd), delim)) { return byLine(File(fd), delim); }
+
+inline auto byLine(const char* f, char delim = '\n')
+  -> decltype(byLine(File(f), delim)) { return byLine(File(f), delim); }
+
 }}  // !folly::gen