* \param[in] str The input string to be converted.
*
* \param[in] idx Location to store the index at which processing
- * stopped.
+ * stopped. If the input `str` is empty, `*idx` shall be set to 0.
*
* \param[in] base The numerical base for conversion.
*
static_assert(std::numeric_limits<T>::is_integer, "checked_stoi: The `T` type must be an integer");
if (str.empty()) {
+ if (idx != nullptr) {
+ *idx = 0;
+ }
+
return 0; // compatibility
}
* \param[in] str The input string to be converted.
*
* \param[in] idx Location to store the index at which processing
- * stopped.
+ * stopped. If the input `str` is empty, `*idx` shall be set to 0.
*
* \param[in] base The numerical base for conversion.
*