git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
C++: make any::make_shared the same as std::make_shared
0ce22bcAndy Arvanitis
pcc/include/purescript.cc+1−1
@@ -66,7 +66,7 @@ auto any::operator=(const any& rhs) -> any& {
66}
66}
67
67
68// Takes ownership -- might need to reconsider this
68// Takes ownership -- might need to reconsider this
69−auto any::operator=(any& rhs) -> any& {
69+auto any::operator=(any& rhs) noexcept -> any& {
70 move_data(rhs);
70 move_data(rhs);
71 return *this;
71 return *this;
72}
72}
pcc/include/purescript.hh+4−9
@@ -76,14 +76,9 @@ class any {
76 template <typename T>
76 template <typename T>
77 using shared = std::shared_ptr<T>;
77 using shared = std::shared_ptr<T>;
78
78
79− template <typename T>
79+ template <typename T, typename... Args>
80− static constexpr auto make_shared(const T& arg) -> shared<T> {
80+ inline static auto make_shared(Args&&... args) -> decltype(std::make_shared<T>(std::forward<Args>(args)...)) {
81− return std::make_shared<T>(arg);
82− }
83−
84− template <typename T>
85− static constexpr auto make_shared(T&& arg) noexcept -> shared<T> {
86− return std::make_shared<T>(std::move(arg));
81+ return std::make_shared<T>(std::forward<Args>(args)...);
87 }
82 }
88
83
89 private:
84 private:
@@ -148,7 +143,7 @@ class any {
148 any(any&&) noexcept;
143 any(any&&) noexcept;
149
144
150 auto operator=(const any&) -> any&;
145 auto operator=(const any&) -> any&;
151− auto operator=(any&) -> any&;
146+ auto operator=(any&) noexcept -> any&;
152 auto operator=(any&&) noexcept -> any&;
147 auto operator=(any&&) noexcept -> any&;
153
148
154 any() = delete;
149 any() = delete;