tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
atol.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_CSTDLIB_ATOL_HPP
5#define TETL_CSTDLIB_ATOL_HPP
6
7#include <etl/_strings/to_integer.hpp>
8
9namespace etl {
10
11/// \brief Interprets an integer value in a byte string pointed to by str.
12/// Discards any whitespace characters until the first non-whitespace character
13/// is found, then takes as many characters as possible to form a valid integer
14/// number representation and converts them to an integer value.
15[[nodiscard]] constexpr auto atol(char const* str) noexcept -> long
16{
17 auto const result = strings::to_integer<long>(str);
18 return result.value;
19}
20
21} // namespace etl
22
23#endif // TETL_CSTDLIB_ATOL_HPP
Definition find.hpp:9
constexpr auto to_integer(string_view str, Int base=Int(10)) noexcept -> to_integer_result< Int >
Definition to_integer.hpp:98
Definition adjacent_find.hpp:9
constexpr auto atol(char const *str) noexcept -> long
Interprets an integer value in a byte string pointed to by str. Discards any whitespace characters un...
Definition atol.hpp:15