4#ifndef TETL_STRING_TO_STRING_HPP
5#define TETL_STRING_TO_STRING_HPP
7#include <etl/_contracts/check.hpp>
8#include <etl/_iterator/data.hpp>
9#include <etl/_string/basic_inplace_string.hpp>
10#include <etl/_strings/from_integer.hpp>
16template <
etl::size_t Capacity,
typename Int>
17constexpr auto to_string(Int val) ->
etl::inplace_string<Capacity>
19 char buffer[Capacity]{};
20 auto const res =
etl::
strings::from_integer<Int>(val,
etl::data(buffer), Capacity, 10);
21 TETL_PRECONDITION(res.error == etl::strings::from_integer_error::none);
22 return etl::inplace_string<Capacity>{
etl::data(buffer), res.end};
28template <
etl::size_t Capacity>
29[[nodiscard]]
constexpr auto to_string(
int value)
noexcept ->
etl::inplace_string<Capacity>
31 return etl::detail::to_string<Capacity,
int>(value);
35template <
etl::size_t Capacity>
36[[nodiscard]]
constexpr auto to_string(
long value)
noexcept ->
etl::inplace_string<Capacity>
38 return etl::detail::to_string<Capacity,
long>(value);
42template <
etl::size_t Capacity>
43[[nodiscard]]
constexpr auto to_string(
long long value)
noexcept ->
etl::inplace_string<Capacity>
45 return etl::detail::to_string<Capacity,
long long>(value);
49template <
etl::size_t Capacity>
50[[nodiscard]]
constexpr auto to_string(
unsigned value)
noexcept ->
etl::inplace_string<Capacity>
52 return etl::detail::to_string<Capacity,
unsigned>(value);
56template <
etl::size_t Capacity>
57[[nodiscard]]
constexpr auto to_string(
unsigned long value)
noexcept ->
etl::inplace_string<Capacity>
59 return etl::detail::to_string<Capacity,
unsigned long>(value);
63template <
etl::size_t Capacity>
64[[nodiscard]]
constexpr auto to_string(
unsigned long long value)
noexcept ->
etl::inplace_string<Capacity>
66 return etl::detail::to_string<Capacity,
unsigned long long>(value);
Definition adjacent_find.hpp:9
constexpr auto to_string(long long value) noexcept -> etl::inplace_string< Capacity >
Converts a numeric value to etl::inplace_string.
Definition to_string.hpp:43
constexpr auto to_string(unsigned value) noexcept -> etl::inplace_string< Capacity >
Converts a numeric value to etl::inplace_string.
Definition to_string.hpp:50
constexpr auto to_string(unsigned long value) noexcept -> etl::inplace_string< Capacity >
Converts a numeric value to etl::inplace_string.
Definition to_string.hpp:57
constexpr auto to_string(unsigned long long value) noexcept -> etl::inplace_string< Capacity >
Converts a numeric value to etl::inplace_string.
Definition to_string.hpp:64
constexpr auto to_string(long value) noexcept -> etl::inplace_string< Capacity >
Converts a numeric value to etl::inplace_string.
Definition to_string.hpp:36
constexpr auto to_string(int value) noexcept -> etl::inplace_string< Capacity >
Converts a numeric value to etl::inplace_string.
Definition to_string.hpp:29