mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-10 17:37:14 +00:00
Add noexcept to various OrtCallback utility class methods to fix warnings. (#4056)
This commit is contained in:
parent
23c313cb73
commit
9f7d245446
1 changed files with 7 additions and 7 deletions
|
|
@ -19,16 +19,16 @@ void OrtRunCallback(OrtCallback* f) noexcept;
|
|||
* Useful for something like a std::unique_ptr<> deleter.
|
||||
*/
|
||||
struct OrtCallbackInvoker {
|
||||
OrtCallbackInvoker()
|
||||
OrtCallbackInvoker() noexcept
|
||||
: callback{nullptr, nullptr} {}
|
||||
|
||||
OrtCallbackInvoker(OrtCallback callback_to_invoke)
|
||||
OrtCallbackInvoker(OrtCallback callback_to_invoke) noexcept
|
||||
: callback(callback_to_invoke) {}
|
||||
|
||||
OrtCallback callback;
|
||||
|
||||
template <typename T>
|
||||
void operator()(T) {
|
||||
void operator()(T) noexcept {
|
||||
if (callback.f) {
|
||||
callback.f(callback.param);
|
||||
}
|
||||
|
|
@ -40,16 +40,16 @@ struct OrtCallbackInvoker {
|
|||
*/
|
||||
class ScopedOrtCallbackInvoker {
|
||||
public:
|
||||
explicit ScopedOrtCallbackInvoker(OrtCallback callback)
|
||||
explicit ScopedOrtCallbackInvoker(OrtCallback callback) noexcept
|
||||
: callback_(callback) {}
|
||||
|
||||
ScopedOrtCallbackInvoker(ScopedOrtCallbackInvoker&& other)
|
||||
ScopedOrtCallbackInvoker(ScopedOrtCallbackInvoker&& other) noexcept
|
||||
: callback_(other.callback_) {
|
||||
other.callback_.f = nullptr;
|
||||
other.callback_.param = nullptr;
|
||||
}
|
||||
|
||||
ScopedOrtCallbackInvoker& operator=(ScopedOrtCallbackInvoker&& other) {
|
||||
ScopedOrtCallbackInvoker& operator=(ScopedOrtCallbackInvoker&& other) noexcept {
|
||||
if (callback_.f) {
|
||||
callback_.f(callback_.param);
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ class ScopedOrtCallbackInvoker {
|
|||
return *this;
|
||||
}
|
||||
|
||||
~ScopedOrtCallbackInvoker() {
|
||||
~ScopedOrtCallbackInvoker() noexcept {
|
||||
if (callback_.f) {
|
||||
callback_.f(callback_.param);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue