We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The compiler is failing to find an appropriate overload for the fmt::join function that works with std::vector<int> or other std::vector<xxx>.
fmt::join
std::vector<int>
std::vector<xxx>
Environment:
Error message:
C:\Users\leenhawk\Workspace\stamp2\main.cpp(137): error C2672: 'fmt::v11::join': no matching overloaded function found C:\Users\leenhawk\Workspace\stamp2\cmake-build-debug\_deps\fmt-src\include\fmt\xchar.h(157): note: it could be 'fmt::v11::tuple_join_view<wchar_t,T...> fmt::v11::join(const std::tuple<_Types...> &,fmt::v11::basic_string_view<wchar_t>)' C:\Users\leenhawk\Workspace\stamp2\main.cpp(137): note: 'fmt::v11::tuple_join_view<wchar_t,T...> fmt::v11::join(const std::tuple<_Types...> &,fmt::v11::basic_string_view<wchar_t>)': cannot deduce 'const std::tuple<_Types...> &' from 'const std::vector<std::string,std::allocator<std::string>>' C:\Users\leenhawk\Workspace\stamp2\cmake-build-debug\_deps\fmt-src\include\fmt\xchar.h(151): note: or 'fmt::v11::join_view<const T*,const T*,wchar_t> fmt::v11::join(std::initializer_list<_Elem>,fmt::v11::basic_string_view<wchar_t>)' C:\Users\leenhawk\Workspace\stamp2\main.cpp(137): note: 'fmt::v11::join_view<const T*,const T*,wchar_t> fmt::v11::join(std::initializer_list<_Elem>,fmt::v11::basic_string_view<wchar_t>)': cannot deduce 'std::initializer_list<_Elem>' from 'const std::vector<std::string,std::allocator<std::string>>' C:\Users\leenhawk\Workspace\stamp2\cmake-build-debug\_deps\fmt-src\include\fmt\xchar.h(144): note: or 'fmt::v11::join_view<unknown-type,unknown-type,wchar_t> fmt::v11::join(Range &&,fmt::v11::basic_string_view<wchar_t>)' C:\Users\leenhawk\Workspace\stamp2\main.cpp(137): note: 'initialization': cannot convert 'const char [3]' to 'fmt::v11::basic_string_view<wchar_t>' C:\Users\leenhawk\Workspace\stamp2\main.cpp(137): note: 'fmt::v11::basic_string_view<wchar_t>::basic_string_view': no overloaded function can convert all argument types C:\Users\leenhawk\Workspace\stamp2\cmake-build-debug\_deps\fmt-src\include\fmt\base.h(521): note: it could be 'fmt::v11::basic_string_view<wchar_t>::basic_string_view(const Char *)' with [ Char=wchar_t ] C:\Users\leenhawk\Workspace\stamp2\main.cpp(137): note: 'fmt::v11::basic_string_view<wchar_t>::basic_string_view(const Char *)': cannot convert argument 1 from 'const char [3]' to 'const Char *' with [ Char=wchar_t ] C:\Users\leenhawk\Workspace\stamp2\main.cpp(137): note: types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
The minimal reproducal example:
CMakeLists.txt
cmake_minimum_required(VERSION 3.30 FATAL_ERROR) set(CMAKE_CXX_STANDARD 23) set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "0e5b6991-d74f-4b3d-a41c-cf096e0b2508") set(CMAKE_CXX_MODULE_STD 1) project(main LANGUAGES CXX) add_executable(main main.cpp) include(FetchContent) FetchContent_Declare( fmt GIT_REPOSITORY https://github.com/fmtlib/fmt GIT_TAG 0c9fce2ffefecfdce794e1859584e25877b7b592) # 11.0.2 FetchContent_MakeAvailable(fmt) #target_link_libraries(main fmt::fmt) target_sources(main PUBLIC FILE_SET CXX_MODULES FILES ${fmt_SOURCE_DIR}/src/fmt.cc ) target_include_directories(main PRIVATE ${fmt_SOURCE_DIR}/include)
main.cpp
import fmt; import std; int main(int argc, char* argv[]) { auto v = std::vector<int>{1, 2, 3}; fmt::print("{}", fmt::join(v, ", ")); return 0; }
The text was updated successfully, but these errors were encountered:
There is a example working correctly in goltbot with#include:
#include
#include <fmt/ranges.h> #include <vector> #include <string> int main() { auto v = std::vector<std::string>{"1", "2", "3"}; fmt::print("{}", fmt::join(v, ", ")); }
Sorry, something went wrong.
Looks like this overload of join is currently not marked as exported:
join
fmt/include/fmt/ranges.h
Line 700 in 0253754
A PR to fix it would be welcome.
Successfully merging a pull request may close this issue.
The compiler is failing to find an appropriate overload for the
fmt::join
function that works withstd::vector<int>
or otherstd::vector<xxx>
.Environment:
Error message:
The minimal reproducal example:
CMakeLists.txt
main.cpp
The text was updated successfully, but these errors were encountered: