git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
C++: add noexcept to more constructors
fa9c565Andy Arvanitis
pcc/include/purescript.hh+20−20
@@ -146,23 +146,23 @@ class any {
146
146
147 public:
147 public:
148
148
149− any(const long val) : type(Type::Integer), i(val) {}
149+ any(const long val) noexcept : type(Type::Integer), i(val) {}
150− any(const int val) : type(Type::Integer), i(val) {}
150+ any(const int val) noexcept : type(Type::Integer), i(val) {}
151− any(const unsigned int val) : type(Type::Integer), i(val) {}
151+ any(const unsigned int val) noexcept : type(Type::Integer), i(val) {}
152− any(const double val) : type(Type::Double), d(val) {}
152+ any(const double val) noexcept : type(Type::Double), d(val) {}
153− any(const char val) : type(Type::Character), c(val) {}
153+ any(const char val) noexcept : type(Type::Character), c(val) {}
154
154
155 template <typename T, typename = typename std::enable_if<std::is_same<bool,T>::value>::type>
155 template <typename T, typename = typename std::enable_if<std::is_same<bool,T>::value>::type>
156− any(const T val) : type(Type::Boolean), b(val) {}
156+ any(const T val) noexcept : type(Type::Boolean), b(val) {}
157
157
158 template <size_t N>
158 template <size_t N>
159− any(const char (&val)[N]) : type(Type::StringLiteral), r(val) {}
159+ any(const char (&val)[N]) noexcept : type(Type::StringLiteral), r(val) {}
160 any(char * val) : type(Type::String), s(make_shared<std::string>(val)) {}
160 any(char * val) : type(Type::String), s(make_shared<std::string>(val)) {}
161
161
162 any(const std::string& val) : type(Type::String), s(make_shared<std::string>(val)) {}
162 any(const std::string& val) : type(Type::String), s(make_shared<std::string>(val)) {}
163− any(std::string&& val) : type(Type::String), s(make_shared<std::string>(std::move(val))) {}
163+ any(std::string&& val) noexcept : type(Type::String), s(make_shared<std::string>(std::move(val))) {}
164
164
165− any(const shared<std::string>& val) : type(Type::String), s(val) {}
165+ any(const shared<std::string>& val) noexcept : type(Type::String), s(val) {}
166 any(shared<std::string>&& val) noexcept : type(Type::String), s(std::move(val)) {}
166 any(shared<std::string>&& val) noexcept : type(Type::String), s(std::move(val)) {}
167
167
168 any(const map& val) : type(Type::Map), m(make_shared<map>(val)) {}
168 any(const map& val) : type(Type::Map), m(make_shared<map>(val)) {}
@@ -175,7 +175,7 @@ class any {
175 any(array&& val) noexcept : type(Type::Array), a(make_shared<array>(std::move(val))) {}
175 any(array&& val) noexcept : type(Type::Array), a(make_shared<array>(std::move(val))) {}
176
176
177 template <typename T>
177 template <typename T>
178− any(const T& val, typename std::enable_if<std::is_convertible<T,fn>::value>::type* = 0)
178+ any(const T& val, typename std::enable_if<std::is_convertible<T,fn>::value>::type* = 0) noexcept
179 : type(Type::Function), f(val) {}
179 : type(Type::Function), f(val) {}
180
180
181 template <typename T, typename = typename std::enable_if<!std::is_same<any,T>::value &&
181 template <typename T, typename = typename std::enable_if<!std::is_same<any,T>::value &&
@@ -188,22 +188,22 @@ class any {
188 : type(Type::EffFunction), e(make_shared<_eff_fn<T>>(val)) {}
188 : type(Type::EffFunction), e(make_shared<_eff_fn<T>>(val)) {}
189
189
190 template <typename T>
190 template <typename T>
191− any(const T& val, typename std::enable_if<std::is_convertible<T,thunk>::value>::type* = 0)
191+ any(const T& val, typename std::enable_if<std::is_convertible<T,thunk>::value>::type* = 0) noexcept
192 : type(Type::Thunk), t(val) {}
192 : type(Type::Thunk), t(val) {}
193
193
194 template <typename T>
194 template <typename T>
195− any(const T& val, typename std::enable_if<std::is_assignable<shared<void>,T>::value>::type* = 0)
195+ any(const T& val, typename std::enable_if<std::is_assignable<shared<void>,T>::value>::type* = 0) noexcept
196 : type(Type::Pointer), p(val) {}
196 : type(Type::Pointer), p(val) {}
197
197
198 template <typename T>
198 template <typename T>
199 any(T&& val, typename std::enable_if<std::is_assignable<shared<void>,T>::value>::type* = 0) noexcept
199 any(T&& val, typename std::enable_if<std::is_assignable<shared<void>,T>::value>::type* = 0) noexcept
200 : type(Type::Pointer), p(std::move(val)) {}
200 : type(Type::Pointer), p(std::move(val)) {}
201
201
202− any(std::nullptr_t) : type(Type::Pointer), p(nullptr) {}
202+ any(std::nullptr_t) noexcept : type(Type::Pointer), p(nullptr) {}
203
203
204 private:
204 private:
205
205
206− auto copy(const any& other) const -> void {
206+ auto copy(const any& other) const noexcept -> void {
207 if (type & Type::Shared) {
207 if (type & Type::Shared) {
208 new (&p) shared<void>(other.p);
208 new (&p) shared<void>(other.p);
209 } else {
209 } else {
@@ -211,7 +211,7 @@ class any {
211 }
211 }
212 }
212 }
213
213
214− auto move(any& other) const noexcept -> void {
214+ auto move(any&& other) const noexcept -> void {
215 if (type & Type::Shared) {
215 if (type & Type::Shared) {
216 new (&p) shared<void>(std::move(other.p));
216 new (&p) shared<void>(std::move(other.p));
217 } else {
217 } else {
@@ -219,7 +219,7 @@ class any {
219 }
219 }
220 }
220 }
221
221
222− auto destruct() noexcept -> void {
222+ auto destruct() -> void {
223 if (type & Type::Shared) {
223 if (type & Type::Shared) {
224 p.~shared<void>();
224 p.~shared<void>();
225 }
225 }
@@ -227,15 +227,15 @@ class any {
227
227
228 public:
228 public:
229
229
230− any(const any& other) : type(other.type) {
230+ any(const any& other) noexcept : type(other.type) {
231 copy(other);
231 copy(other);
232 }
232 }
233
233
234 any(any&& other) noexcept : type(other.type) {
234 any(any&& other) noexcept : type(other.type) {
235− move(other);
235+ move(std::move(other));
236 }
236 }
237
237
238− auto operator=(const any& rhs) -> any& {
238+ auto operator=(const any& rhs) noexcept -> any& {
239 destruct();
239 destruct();
240 type = rhs.type;
240 type = rhs.type;
241 copy(rhs);
241 copy(rhs);
@@ -245,7 +245,7 @@ class any {
245 auto operator=(any&& rhs) noexcept -> any& {
245 auto operator=(any&& rhs) noexcept -> any& {
246 destruct();
246 destruct();
247 type = rhs.type;
247 type = rhs.type;
248− move(rhs);
248+ move(std::move(rhs));
249 return *this;
249 return *this;
250 }
250 }
251
251