commit | 7db7dade2481ff7113242b943a0f2362aeaacc5a | [log] [tgz] |
---|---|---|
author | David Tolnay <dtolnay@gmail.com> | Sat Apr 11 14:12:49 2020 -0700 |
committer | David Tolnay <dtolnay@gmail.com> | Sat Apr 11 14:12:49 2020 -0700 |
tree | 686705ff3ec96c237e5ffed4047c637afed07532 | |
parent | dd8d06c4b9ffe3eacb06bda051250c1a1682ddcd [diff] |
Make it explicit when going from T to Box<T>
diff --git a/include/cxx.h b/include/cxx.h index 157c31e..2ffacc5 100644 --- a/include/cxx.h +++ b/include/cxx.h
@@ -94,11 +94,11 @@ Box(const Box &other) : Box(*other) {} Box(Box &&other) noexcept : ptr(other.ptr) { other.ptr = nullptr; } - Box(const T &val) { + explicit Box(const T &val) { this->uninit(); ::new (this->ptr) T(val); } - Box(T &&val) { + explicit Box(T &&val) { this->uninit(); ::new (this->ptr) T(std::move(val)); }