Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export all range join overloads #4239

Merged
merged 1 commit into from
Nov 15, 2024
Merged

Export all range join overloads #4239

merged 1 commit into from
Nov 15, 2024

Conversation

Arghnews
Copy link
Contributor

Fixes #4190
Have tested on my local machine and couldn't compile

  auto v = std::vector<std::string>{"1", "2", "3"};
    fmt::print("{}", fmt::join(v, ", "));

Without this, now can

Don't think can write a test for this change as currently the tests use:

fmt/test/CMakeLists.txt

Lines 101 to 112 in 9ced61b

if (FMT_MODULE)
# The tests need {fmt} to be compiled as traditional library
# because of visibility of implementation details.
# If module support is present the module tests require a
# test-only module to be built from {fmt}
add_library(test-module OBJECT ${CMAKE_SOURCE_DIR}/src/fmt.cc)
target_compile_features(test-module PUBLIC cxx_std_11)
target_include_directories(test-module PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
enable_module(test-module)
add_fmt_test(module-test MODULE test-main.cc)

Which is presumably how it doesn't get picked up an not-exported right now. A test for its usage does already exist anyway:

fmt/test/module-test.cc

Lines 385 to 394 in 9ced61b

TEST(module_test, join) {
int arr[3] = {1, 2, 3};
std::vector<double> vec{1.0, 2.0, 3.0};
std::initializer_list<int> il{1, 2, 3};
auto sep = fmt::string_view(", ");
EXPECT_EQ("1, 2, 3", to_string(fmt::join(arr + 0, arr + 3, sep)));
EXPECT_EQ("1, 2, 3", to_string(fmt::join(arr, sep)));
EXPECT_EQ("1, 2, 3", to_string(fmt::join(vec.begin(), vec.end(), sep)));
EXPECT_EQ("1, 2, 3", to_string(fmt::join(vec, sep)));
EXPECT_EQ("1, 2, 3", to_string(fmt::join(il, sep)));

@vitaut vitaut merged commit 536cabd into fmtlib:master Nov 15, 2024
45 checks passed
@vitaut
Copy link
Contributor

vitaut commented Nov 15, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

join couldn't be found an appropriate overload when fmt is imported as a module.
2 participants