Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Unified Diff: base/memory/manual_constructor.h

Issue 1738883004: Support for move-only types in SmallMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/containers/small_map_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/manual_constructor.h
diff --git a/base/memory/manual_constructor.h b/base/memory/manual_constructor.h
index 56081a1d3bc5362a6797a2aeca2d2516f74689f6..f401f62d513803803efdd4de3a8b1de8ede9ba9f 100644
--- a/base/memory/manual_constructor.h
+++ b/base/memory/manual_constructor.h
@@ -54,8 +54,12 @@ class ManualConstructor {
inline const Type& operator*() const { return *get(); }
template <typename... Ts>
- inline void Init(const Ts&... params) {
- new(space_.void_data()) Type(params...);
+ inline void Init(Ts&&... params) {
+ new(space_.void_data()) Type(std::forward<Ts>(params)...);
+ }
+
+ inline void InitFromMove(ManualConstructor<Type>&& o) {
+ Init(std::move(*o));
}
inline void Destroy() {
« no previous file with comments | « base/containers/small_map_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698