]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: Add in_place_t/in_place_type_t from C++17
authorAdam C. Emerson <aemerson@redhat.com>
Wed, 26 Jul 2017 22:08:32 +0000 (18:08 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Wed, 9 Aug 2017 02:53:12 +0000 (22:53 -0400)
To better signal in-place construction among other overloads.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/common/backport14.h

index 3e6505d468d31fdfc6afe6da0f75b49ec88b1058..5e55d714a1aaf8ccccd26b67913b7cf7823bec30 100644 (file)
@@ -118,11 +118,27 @@ not_fn_result<F> not_fn(F&& fn) {
   return not_fn_result<F>(std::forward<F>(fn));
 }
 
+struct in_place_t {};
+constexpr in_place_t in_place{};
+
+template<typename T>
+struct in_place_type_t {};
+
+#ifdef __cpp_variable_templates
+template<typename T>
+constexpr in_place_type_t<T> in_place_type{};
+#endif // __cpp_variable_templates
 } // namespace _backport17
 using _backport14::make_unique;
 using _backport17::size;
 using _backport14::max;
 using _backport17::not_fn;
+using _backport17::in_place_t;
+using _backport17::in_place;
+using _backport17::in_place_type_t;
+#ifdef __cpp_variable_templates
+using _backport17::in_place_type;
+#endif // __cpp_variable_templates
 } // namespace ceph
 
 #endif // CEPH_COMMON_BACKPORT14_H