add array.h/cpp

This commit is contained in:
2025-02-27 16:18:38 +08:00
parent f44aaa81b2
commit d0fd9eb4f0
7 changed files with 410 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
message(STATUS "Checking that std::from_chars for floats is supported by the C++ library")
try_compile(FROM_CHARS_WORKS "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_LIST_DIR}/check-from_chars.cpp")
if(FROM_CHARS_WORKS)
message(STATUS "Checking that std::from_chars for floats is supported by the C++ library - yes")
else()
message(STATUS "Checking that std::from_chars for floats is supported by the C++ library - NO")
endif()

View File

@@ -0,0 +1,8 @@
#include <charconv>
int main()
{
const char str[] = "1.2345e3";
float num;
std::from_chars(str, str + sizeof str - 1, num);
}