// SPDX-License-Identifier: MIT /** Copyright (C) 2023 Beckhoff Automation GmbH & Co. KG */ #pragma once #include namespace Beckhoff { template static T try_stoi(const char* str, const T defaultValue = 0) { try { if (str && *str) { return static_cast(std::stoi(++str)); } } catch (...) {} return defaultValue; } }