Commit 6031a631 authored by Marcelo Juchem's avatar Marcelo Juchem Committed by Alecs King

Deprecating folly::is_complete

Summary: Deprecating folly::is_complete. Replacement is fatal::is_complete.

Test Plan: unit tests

Reviewed By: njormrod@fb.com

Subscribers: njormrod, folly-diffs@, yfeldblum, chalfant

FB internal diff: D1979124

Tasks: 6697454, 6697600

Signature: t1:1979124:1429153237:dc5736ed0f546dd4dd57bda9176e3c3c13b1235d
parent 0011d8a0
...@@ -290,34 +290,6 @@ struct IsOneOf<T, T1, Ts...> { ...@@ -290,34 +290,6 @@ struct IsOneOf<T, T1, Ts...> {
enum { value = std::is_same<T, T1>::value || IsOneOf<T, Ts...>::value }; enum { value = std::is_same<T, T1>::value || IsOneOf<T, Ts...>::value };
}; };
/**
* A traits class to check for incomplete types.
*
* Example:
*
* struct FullyDeclared {}; // complete type
* struct ForwardDeclared; // incomplete type
*
* is_complete<int>::value // evaluates to true
* is_complete<FullyDeclared>::value // evaluates to true
* is_complete<ForwardDeclared>::value // evaluates to false
*
* struct ForwardDeclared {}; // declared, at last
*
* is_complete<ForwardDeclared>::value // now it evaluates to true
*
* @author: Marcelo Juchem <marcelo@fb.com>
*/
template <typename T>
class is_complete {
template <unsigned long long> struct sfinae {};
template <typename U>
constexpr static bool test(sfinae<sizeof(U)>*) { return true; }
template <typename> constexpr static bool test(...) { return false; }
public:
constexpr static bool value = test<T>(nullptr);
};
/* /*
* Complementary type traits for integral comparisons. * Complementary type traits for integral comparisons.
* *
......
...@@ -110,14 +110,6 @@ TEST(Traits, relational) { ...@@ -110,14 +110,6 @@ TEST(Traits, relational) {
EXPECT_FALSE((folly::greater_than<uint8_t, 255u, uint8_t>(254u))); EXPECT_FALSE((folly::greater_than<uint8_t, 255u, uint8_t>(254u)));
} }
struct CompleteType {};
struct IncompleteType;
TEST(Traits, is_complete) {
EXPECT_TRUE((folly::is_complete<int>::value));
EXPECT_TRUE((folly::is_complete<CompleteType>::value));
EXPECT_FALSE((folly::is_complete<IncompleteType>::value));
}
int main(int argc, char ** argv) { int main(int argc, char ** argv) {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
gflags::ParseCommandLineFlags(&argc, &argv, true); gflags::ParseCommandLineFlags(&argc, &argv, true);
......
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