summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorADAM David Alan Martin <adam.martin@10gen.com>2017-03-30 19:15:56 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2017-03-30 19:15:56 -0400
commited80d2d3c5735c424e5c1cd58169077327976d2e (patch)
treebb6d806f8e058c7012e213bbca52a5499b3dc1e2
parent44a255411673084a9ec10ce34a9535b828943d90 (diff)
downloadmongo-ed80d2d3c5735c424e5c1cd58169077327976d2e.tar.gz
SERVER-28551 Implementation of `void_t` in stdx.
There are a lot of template metaprograms and `std::enable_if` expressions which we'd like to use in our codebase. This import of a C++17 future feature will help make them easier to write.
-rw-r--r--src/mongo/stdx/type_traits.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mongo/stdx/type_traits.h b/src/mongo/stdx/type_traits.h
index 9fc95279b98..40503382d96 100644
--- a/src/mongo/stdx/type_traits.h
+++ b/src/mongo/stdx/type_traits.h
@@ -52,5 +52,31 @@ using enable_if_t = typename std::enable_if<B, T>::type;
} // namespace stdx
} // namespace mongo
+#endif
+
+#if __cplusplus >= 201703
+
+namespace mongo {
+namespace stdx {
+
+using std::void_t;
+
+} // namespace stdx
+} // namespace mongo
+#elif __cplusplus >= 201402
+
+namespace mongo {
+namespace stdx {
+
+template <typename...>
+struct make_void {
+ using type = void;
+};
+
+template <typename... Args>
+using void_t = typename make_void<Args...>::type;
+
+} // namespace stdx
+} // namespace mongo
#endif