Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
// -*- C++ -*-
|
2024-05-27 09:12:27 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef _LIBCPP_CHARCONV
|
|
|
|
#define _LIBCPP_CHARCONV
|
|
|
|
|
|
|
|
/*
|
|
|
|
charconv synopsis
|
|
|
|
|
|
|
|
namespace std {
|
|
|
|
|
|
|
|
// floating-point format for primitive numerical conversion
|
|
|
|
enum class chars_format {
|
|
|
|
scientific = unspecified,
|
|
|
|
fixed = unspecified,
|
|
|
|
hex = unspecified,
|
|
|
|
general = fixed | scientific
|
|
|
|
};
|
|
|
|
|
|
|
|
// 23.20.2, primitive numerical output conversion
|
|
|
|
struct to_chars_result {
|
|
|
|
char* ptr;
|
|
|
|
errc ec;
|
2024-05-27 09:12:27 +00:00
|
|
|
friend bool operator==(const to_chars_result&, const to_chars_result&) = default; // since C++20
|
2024-07-23 10:16:17 +00:00
|
|
|
constexpr explicit operator bool() const noexcept { return ec == errc{}; } // since C++26
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
};
|
|
|
|
|
2024-05-27 09:12:27 +00:00
|
|
|
constexpr to_chars_result to_chars(char* first, char* last, see below value,
|
|
|
|
int base = 10); // constexpr since C++23
|
|
|
|
to_chars_result to_chars(char* first, char* last, bool value,
|
|
|
|
int base = 10) = delete;
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
|
|
|
|
to_chars_result to_chars(char* first, char* last, float value);
|
|
|
|
to_chars_result to_chars(char* first, char* last, double value);
|
|
|
|
to_chars_result to_chars(char* first, char* last, long double value);
|
|
|
|
|
|
|
|
to_chars_result to_chars(char* first, char* last, float value,
|
|
|
|
chars_format fmt);
|
|
|
|
to_chars_result to_chars(char* first, char* last, double value,
|
|
|
|
chars_format fmt);
|
|
|
|
to_chars_result to_chars(char* first, char* last, long double value,
|
|
|
|
chars_format fmt);
|
|
|
|
|
|
|
|
to_chars_result to_chars(char* first, char* last, float value,
|
|
|
|
chars_format fmt, int precision);
|
|
|
|
to_chars_result to_chars(char* first, char* last, double value,
|
|
|
|
chars_format fmt, int precision);
|
|
|
|
to_chars_result to_chars(char* first, char* last, long double value,
|
|
|
|
chars_format fmt, int precision);
|
|
|
|
|
|
|
|
// 23.20.3, primitive numerical input conversion
|
|
|
|
struct from_chars_result {
|
|
|
|
const char* ptr;
|
|
|
|
errc ec;
|
2024-05-27 09:12:27 +00:00
|
|
|
friend bool operator==(const from_chars_result&, const from_chars_result&) = default; // since C++20
|
2024-07-23 10:16:17 +00:00
|
|
|
constexpr explicit operator bool() const noexcept { return ec == errc{}; } // since C++26
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
};
|
|
|
|
|
2024-05-27 09:12:27 +00:00
|
|
|
constexpr from_chars_result from_chars(const char* first, const char* last,
|
|
|
|
see below& value, int base = 10); // constexpr since C++23
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
|
|
|
|
} // namespace std
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2024-05-27 09:12:27 +00:00
|
|
|
#include <__config>
|
2024-07-23 10:16:17 +00:00
|
|
|
|
|
|
|
#if _LIBCPP_STD_VER >= 17
|
|
|
|
# include <__charconv/chars_format.h>
|
|
|
|
# include <__charconv/from_chars_integral.h>
|
|
|
|
# include <__charconv/from_chars_result.h>
|
|
|
|
# include <__charconv/tables.h>
|
|
|
|
# include <__charconv/to_chars.h>
|
|
|
|
# include <__charconv/to_chars_base_10.h>
|
|
|
|
# include <__charconv/to_chars_floating_point.h>
|
|
|
|
# include <__charconv/to_chars_integral.h>
|
|
|
|
# include <__charconv/to_chars_result.h>
|
|
|
|
# include <__charconv/traits.h>
|
|
|
|
#endif // _LIBCPP_STD_VER >= 17
|
|
|
|
|
|
|
|
#include <version>
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
|
2024-05-27 09:12:27 +00:00
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
|
|
# pragma GCC system_header
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
#endif
|
|
|
|
|
2024-05-27 09:12:27 +00:00
|
|
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
|
|
|
|
_LIBCPP_END_NAMESPACE_STD
|
|
|
|
|
2024-07-23 10:16:17 +00:00
|
|
|
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14
|
|
|
|
# include <cerrno>
|
|
|
|
# include <cstddef>
|
|
|
|
# include <initializer_list>
|
|
|
|
# include <new>
|
|
|
|
#endif
|
|
|
|
|
2024-05-27 09:12:27 +00:00
|
|
|
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
|
2024-07-23 10:16:17 +00:00
|
|
|
# include <cmath>
|
2024-05-27 09:12:27 +00:00
|
|
|
# include <concepts>
|
2024-07-23 10:16:17 +00:00
|
|
|
# include <cstdint>
|
2024-05-27 09:12:27 +00:00
|
|
|
# include <cstdlib>
|
|
|
|
# include <cstring>
|
|
|
|
# include <iosfwd>
|
2024-07-23 10:16:17 +00:00
|
|
|
# include <limits>
|
2024-05-27 09:12:27 +00:00
|
|
|
# include <type_traits>
|
|
|
|
#endif
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
|
2024-05-27 09:12:27 +00:00
|
|
|
#endif // _LIBCPP_CHARCONV
|