Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions cel-c/activation.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,18 @@ CEL_EXTERN bool cel_Activation_Execute(cel_Activation* cel_nonnull activation,
CEL_END_DECLS

#ifdef __cplusplus
namespace std {
template <>
struct default_delete<::cel_Activation> {
template <typename U>
CEL_INLINE void operator()(U* ptr) const noexcept {
::cel_Activation_Delete(const_cast<::cel_Activation*>(ptr));
struct cel_ActivationDeleter {
CEL_INLINE void operator()(
cel_Activation* cel_nullable activation) const noexcept {
cel_Activation_Delete(activation);
}
CEL_INLINE void operator()(
const cel_Activation* cel_nullable activation) const noexcept {
(*this)(const_cast<cel_Activation*>(activation));
}
};
template <>
struct default_delete<const ::cel_Activation>
: default_delete<::cel_Activation> {};
} // namespace std
using cel_ActivationPtr = std::unique_ptr<cel_Activation>;
using cel_ActivationPtr =
std::unique_ptr<cel_Activation, cel_ActivationDeleter>;
#endif

#endif // THIRD_PARTY_CEL_C_ACTIVATION_H_
18 changes: 8 additions & 10 deletions cel-c/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,16 @@ CEL_EXTERN void cel_Ast_Delete(cel_Ast* cel_nullable ast);
CEL_END_DECLS

#ifdef __cplusplus
namespace std {
template <>
struct default_delete<::cel_Ast> {
template <typename U>
CEL_INLINE void operator()(U* ptr) const noexcept {
::cel_Ast_Delete(const_cast<::cel_Ast*>(ptr));
struct cel_AstDeleter {
CEL_INLINE void operator()(cel_Ast* cel_nullable activation) const noexcept {
cel_Ast_Delete(activation);
}
CEL_INLINE void operator()(
const cel_Ast* cel_nullable activation) const noexcept {
(*this)(const_cast<cel_Ast*>(activation));
}
};
template <>
struct default_delete<const ::cel_Ast> : default_delete<::cel_Ast> {};
} // namespace std
using cel_AstPtr = std::unique_ptr<cel_Ast>;
using cel_AstPtr = std::unique_ptr<cel_Ast, cel_AstDeleter>;
#endif

#endif // THIRD_PARTY_CEL_C_AST_H_
19 changes: 9 additions & 10 deletions cel-c/program.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,17 @@ cel_Program_Activate(const cel_Program* cel_nonnull program,
CEL_END_DECLS

#ifdef __cplusplus
namespace std {
template <>
struct default_delete<::cel_Program> {
template <typename U>
CEL_INLINE void operator()(U* ptr) const noexcept {
::cel_Program_Delete(const_cast<::cel_Program*>(ptr));
struct cel_ProgramDeleter {
CEL_INLINE void operator()(
cel_Program* cel_nullable activation) const noexcept {
cel_Program_Delete(activation);
}
CEL_INLINE void operator()(
const cel_Program* cel_nullable activation) const noexcept {
(*this)(const_cast<cel_Program*>(activation));
}
};
template <>
struct default_delete<const ::cel_Program> : default_delete<::cel_Program> {};
} // namespace std
using cel_ProgramPtr = std::unique_ptr<cel_Program>;
using cel_ProgramPtr = std::unique_ptr<cel_Program, cel_ProgramDeleter>;
#endif

#endif // THIRD_PARTY_CEL_C_PROGRAM_H_
19 changes: 9 additions & 10 deletions cel-c/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,17 @@ CEL_EXTERN cel_Program* cel_nullable cel_Runtime_Compile(
CEL_END_DECLS

#ifdef __cplusplus
namespace std {
template <>
struct default_delete<::cel_Runtime> {
template <typename U>
CEL_INLINE void operator()(U* ptr) const noexcept {
::cel_Runtime_Delete(const_cast<::cel_Runtime*>(ptr));
struct cel_RuntimeDeleter {
CEL_INLINE void operator()(
cel_Runtime* cel_nullable activation) const noexcept {
cel_Runtime_Delete(activation);
}
CEL_INLINE void operator()(
const cel_Runtime* cel_nullable activation) const noexcept {
(*this)(const_cast<cel_Runtime*>(activation));
}
};
template <>
struct default_delete<const ::cel_Runtime> : default_delete<::cel_Runtime> {};
} // namespace std
using cel_RuntimePtr = std::unique_ptr<cel_Runtime>;
using cel_RuntimePtr = std::unique_ptr<cel_Runtime, cel_RuntimeDeleter>;
#endif

#endif // THIRD_PARTY_CEL_C_RUNTIME_H_
Loading