/* * Copyright (C) 2022 Riyyi * * SPDX-License-Identifier: MIT */ #pragma once #include // uint32_t #include // std::numeric_limits #include // std::stoul #include #include "ruc/meta/assert.h" namespace std { // Can't believe this is not in the standard library inline uint32_t stou(string_view string) { unsigned long size = std::stoul(string.data()); VERIFY(size <= std::numeric_limits::max(), "string not in uint32_t range '{}'", string); return static_cast(size); } } // namespace std