From: Christopher Dykes Date: Fri, 1 Jul 2016 01:20:26 +0000 (-0700) Subject: Use decltype rather than typeof X-Git-Tag: 2016.07.26~96 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5f78f71a458c3451a3aa68bf517e83f937f61214;p=folly.git Use decltype rather than typeof Summary: Because `typeof` is a GCC specific extension whose standardized version is called `decltype`. Reviewed By: yfeldblum Differential Revision: D3506960 fbshipit-source-id: 0e7495028632b23f149bf8d0163d2000ebec2fcc --- diff --git a/folly/test/FileUtilTest.cpp b/folly/test/FileUtilTest.cpp index 23a49f96..d79dfd24 100644 --- a/folly/test/FileUtilTest.cpp +++ b/folly/test/FileUtilTest.cpp @@ -159,7 +159,7 @@ TEST_F(FileUtilTest, read) { for (auto& p : readers_) { std::string out(in_.size(), '\0'); EXPECT_EQ(p.first, wrapFull(p.second, 0, &out[0], out.size())); - if (p.first != (typeof(p.first))(-1)) { + if (p.first != (decltype(p.first))(-1)) { EXPECT_EQ(in_.substr(0, p.first), out.substr(0, p.first)); } } @@ -169,7 +169,7 @@ TEST_F(FileUtilTest, pread) { for (auto& p : readers_) { std::string out(in_.size(), '\0'); EXPECT_EQ(p.first, wrapFull(p.second, 0, &out[0], out.size(), off_t(42))); - if (p.first != (typeof(p.first))(-1)) { + if (p.first != (decltype(p.first))(-1)) { EXPECT_EQ(in_.substr(0, p.first), out.substr(0, p.first)); } } @@ -230,7 +230,7 @@ TEST_F(FileUtilTest, readv) { auto iov = buf.iov(); EXPECT_EQ(p.first, wrapvFull(p.second, 0, iov.data(), iov.size())); - if (p.first != (typeof(p.first))(-1)) { + if (p.first != (decltype(p.first))(-1)) { EXPECT_EQ(in_.substr(0, p.first), buf.join().substr(0, p.first)); } } @@ -258,7 +258,7 @@ TEST_F(FileUtilTest, preadv) { auto iov = buf.iov(); EXPECT_EQ(p.first, wrapvFull(p.second, 0, iov.data(), iov.size(), off_t(42))); - if (p.first != (typeof(p.first))(-1)) { + if (p.first != (decltype(p.first))(-1)) { EXPECT_EQ(in_.substr(0, p.first), buf.join().substr(0, p.first)); } } diff --git a/folly/test/ThreadLocalTest.cpp b/folly/test/ThreadLocalTest.cpp index 230aaa33..aaa3794d 100644 --- a/folly/test/ThreadLocalTest.cpp +++ b/folly/test/ThreadLocalTest.cpp @@ -85,7 +85,7 @@ TEST(ThreadLocalPtr, CustomDeleterOwnershipTransfer) { auto deleter = [](Widget* ptr) { Widget::customDeleter(ptr, TLPDestructionMode::THIS_THREAD); }; - std::unique_ptr source(new Widget(), deleter); + std::unique_ptr source(new Widget(), deleter); std::thread([&w, &source]() { w.reset(std::move(source)); w.get()->val_ += 10;