Commit cd30d2d1 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Cut explicit decltype-based return types in folly/gen/File-inl.h

Summary: [Folly] Cut explicit `decltype`-based return types in `folly/gen/File-inl.h` - they only required pre-gcc49.

Reviewed By: Orvid

Differential Revision: D9601484

fbshipit-source-id: 8750091a9ef3e4ba8b8f4e26a96b28fe8d242e7a
parent b9a67dd9
...@@ -120,10 +120,7 @@ class FileWriter : public Operator<FileWriter> { ...@@ -120,10 +120,7 @@ class FileWriter : public Operator<FileWriter> {
std::unique_ptr<IOBuf> buffer_; std::unique_ptr<IOBuf> buffer_;
}; };
inline auto byLineImpl(File file, char delim, bool keepDelimiter) inline auto byLineImpl(File file, char delim, bool keepDelimiter) {
-> decltype(fromFile(std::move(file))
| eachAs<StringPiece>()
| resplit(delim, keepDelimiter)) {
return fromFile(std::move(file)) return fromFile(std::move(file))
| eachAs<StringPiece>() | eachAs<StringPiece>()
| resplit(delim, keepDelimiter); | resplit(delim, keepDelimiter);
...@@ -136,30 +133,29 @@ inline auto byLineImpl(File file, char delim, bool keepDelimiter) ...@@ -136,30 +133,29 @@ inline auto byLineImpl(File file, char delim, bool keepDelimiter)
* Note: This produces StringPieces which reference temporary strings which are * Note: This produces StringPieces which reference temporary strings which are
* only valid during iteration. * only valid during iteration.
*/ */
inline auto byLineFull(File file, char delim = '\n') inline auto byLineFull(File file, char delim = '\n') {
-> decltype(detail::byLineImpl(std::move(file), delim, true)) {
return detail::byLineImpl(std::move(file), delim, true); return detail::byLineImpl(std::move(file), delim, true);
} }
inline auto byLineFull(int fd, char delim = '\n') inline auto byLineFull(int fd, char delim = '\n') {
-> decltype(byLineFull(File(fd), delim)) {
return byLineFull(File(fd), delim); return byLineFull(File(fd), delim);
} }
inline auto byLineFull(const char* f, char delim = '\n') inline auto byLineFull(const char* f, char delim = '\n') {
-> decltype(byLineFull(File(f), delim)) {
return byLineFull(File(f), delim); return byLineFull(File(f), delim);
} }
inline auto byLine(File file, char delim = '\n') inline auto byLine(File file, char delim = '\n') {
-> decltype(detail::byLineImpl(std::move(file), delim, false)) {
return detail::byLineImpl(std::move(file), delim, false); return detail::byLineImpl(std::move(file), delim, false);
} }
inline auto byLine(int fd, char delim = '\n') inline auto byLine(int fd, char delim = '\n') {
-> decltype(byLine(File(fd), delim)) { return byLine(File(fd), delim); } return byLine(File(fd), delim);
}
inline auto byLine(const char* f, char delim = '\n') {
return byLine(File(f), delim);
}
inline auto byLine(const char* f, char delim = '\n')
-> decltype(byLine(File(f), delim)) { return byLine(File(f), delim); }
} // namespace gen } // namespace gen
} // namespace folly } // namespace folly
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment