3#ifndef TETL_STRING_STOI_HPP
4#define TETL_STRING_STOI_HPP
6#include <etl/_concepts/integral.hpp>
7#include <etl/_string_view/basic_string_view.hpp>
8#include <etl/_strings/to_integer.hpp>
14template <etl::integral Int>
15[[nodiscard]]
constexpr auto sto_impl(
etl::string_view str,
etl::size_t* pos,
int base) -> Int
17 auto const res =
strings::to_integer<Int>(str,
static_cast<Int>(base));
19 *pos =
static_cast<etl::size_t>(etl::distance(str.data(), res.end));
32[[
nodiscard]]
constexpr auto stoi(
etl::string_view str,
etl::size_t* pos =
nullptr,
int base = 10) ->
int
34 return detail::sto_impl<
int>(str, pos, base);
43[[
nodiscard]]
constexpr auto stol(
etl::string_view str,
etl::size_t* pos =
nullptr,
int base = 10) ->
long
45 return detail::sto_impl<
long>(str, pos, base);
54[[
nodiscard]]
constexpr auto stoll(
etl::string_view str,
etl::size_t* pos =
nullptr,
int base = 10) ->
long long
56 return detail::sto_impl<
long long>(str, pos, base);
65[[
nodiscard]]
constexpr auto stoul(
etl::string_view str,
etl::size_t* pos =
nullptr,
int base = 10) ->
unsigned long
67 return detail::sto_impl<
unsigned long>(str, pos, base);
79 return detail::sto_impl<
unsigned long long>(str, pos, base);
Definition adjacent_find.hpp:9
constexpr auto stoul(etl::string_view str, etl::size_t *pos=nullptr, int base=10) -> unsigned long
Interprets a signed integer value in the string str.
Definition stoi.hpp:65
constexpr auto stoi(etl::string_view str, etl::size_t *pos=nullptr, int base=10) -> int
Interprets a signed integer value in the string str.
Definition stoi.hpp:32
constexpr auto stoull(etl::string_view str, etl::size_t *pos=nullptr, int base=10) -> unsigned long long
Interprets a signed integer value in the string str.
Definition stoi.hpp:76
constexpr auto stol(etl::string_view str, etl::size_t *pos=nullptr, int base=10) -> long
Interprets a signed integer value in the string str.
Definition stoi.hpp:43
constexpr auto stoll(etl::string_view str, etl::size_t *pos=nullptr, int base=10) -> long long
Interprets a signed integer value in the string str.
Definition stoi.hpp:54