Skip to content

Commit 81b8306

Browse files
committed
1 parent b8085ba commit 81b8306

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.9)
1+
cmake_minimum_required(VERSION 3.14)
22

33
project(fast_float VERSION 8.0.2 LANGUAGES CXX)
44
set(FASTFLOAT_CXX_STANDARD 11 CACHE STRING "the C++ standard to use for fastfloat")

include/fast_float/float_common.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ enum class chars_format : uint64_t {
5858
template <typename UC> struct from_chars_result_t {
5959
UC const *ptr;
6060
std::errc ec;
61+
62+
// https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2497r0.html
63+
constexpr explicit operator bool() const noexcept {
64+
return ec == std::errc();
65+
}
6166
};
6267

6368
using from_chars_result = from_chars_result_t<char>;

tests/CMakeLists.txt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ option(FASTFLOAT_SUPPLEMENTAL_TESTS "Run supplemental tests" ON)
1010
if (NOT SYSTEM_DOCTEST)
1111
FetchContent_Declare(doctest
1212
GIT_REPOSITORY https://github.com/onqtam/doctest.git
13-
GIT_TAG v2.4.11)
13+
GIT_TAG v2.4.12)
1414
else ()
1515
find_package(doctest REQUIRED)
1616
endif()
@@ -23,24 +23,15 @@ endif()
2323

2424
# FetchContent_MakeAvailable() was only introduced in 3.14
2525
# https://cmake.org/cmake/help/v3.14/release/3.14.html#modules
26-
# FetchContent_MakeAvailable(doctest)
2726
if (NOT SYSTEM_DOCTEST)
28-
FetchContent_GetProperties(doctest)
29-
if(NOT doctest_POPULATED)
30-
FetchContent_Populate(doctest)
31-
add_subdirectory(${doctest_SOURCE_DIR} ${doctest_BINARY_DIR})
32-
endif()
27+
FetchContent_MakeAvailable(doctest)
3328
endif()
3429

3530
add_library(supplemental-data INTERFACE)
3631
if (FASTFLOAT_SUPPLEMENTAL_TESTS)
37-
FetchContent_GetProperties(supplemental_test_files)
38-
if(NOT supplemental_test_files_POPULATED)
39-
message(STATUS "Supplemental tests enabled. Retrieving test files.")
40-
FetchContent_Populate(supplemental_test_files)
41-
message(STATUS "Supplemental test files retrieved.")
42-
add_subdirectory(${supplemental_test_files_SOURCE_DIR} ${supplemental_test_files_BINARY_DIR})
43-
endif()
32+
message(STATUS "Supplemental tests enabled. Retrieving test files.")
33+
FetchContent_MakeAvailable(supplemental_test_files)
34+
message(STATUS "Supplemental test files retrieved.")
4435
target_compile_definitions(supplemental-data INTERFACE SUPPLEMENTAL_TEST_DATA_DIR="${supplemental_test_files_BINARY_DIR}/data")
4536
endif()
4637

@@ -82,7 +73,7 @@ endif()
8273
if (FASTFLOAT_SUPPLEMENTAL_TESTS)
8374
target_compile_definitions(basictest PRIVATE FASTFLOAT_SUPPLEMENTAL_TESTS)
8475
endif()
85-
76+
fast_float_add_cpp_test(p2497)
8677
fast_float_add_cpp_test(long_test)
8778
fast_float_add_cpp_test(powersoffive_hardround)
8879
fast_float_add_cpp_test(string_test)

0 commit comments

Comments
 (0)