Skip to content

Commit 79c1234

Browse files
yfeldblumfacebook-github-bot
authored andcommitted
use std::destroy_at in folly::dynamic
Summary: Replace use of `folly::detail::Destroy::destroy` with `std::destroy_at`, available since C++17, in `folly::dynamic`. Reviewed By: ilvokhin Differential Revision: D77837325 fbshipit-source-id: db8d0f5fcc99ceacac422588880a2c8c40142e4e
1 parent b344177 commit 79c1234

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

third-party/folly/src/folly/json/dynamic-inl.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,6 @@ struct FOLLY_EXPORT TypeError : std::runtime_error {
130130

131131
namespace detail {
132132

133-
// This helper is used in destroy() to be able to run destructors on
134-
// types like "int64_t" without a compiler error.
135-
struct Destroy {
136-
template <class T>
137-
static void destroy(T* t) {
138-
t->~T();
139-
}
140-
};
141-
142133
/*
143134
* Helper for implementing numeric conversions in operators on
144135
* numbers. Just promotes to double when one of the arguments is

third-party/folly/src/folly/json/dynamic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ void dynamic::destroy() noexcept {
386386
return;
387387
}
388388

389-
#define FB_X(T) detail::Destroy::destroy(getAddress<T>())
389+
#define FB_X(T) std::destroy_at(getAddress<T>())
390390
FB_DYNAMIC_APPLY(type_, FB_X);
391391
#undef FB_X
392392
}

0 commit comments

Comments
 (0)