fmt/include/fmt
Mike Crowe e6ef927e6b
fmt::ptr: Support function pointers (#2131)
Passing a function pointer to fmt::ptr results in:

 In file included from /home/mac/git/fmt/test/gmock/gmock.h:238,
                  from /home/mac/git/fmt/test/format-test.cc:31:
 .../fmt/test/format-test.cc: In member function ‘virtual void FormatterTest_FormatPointer_Test::TestBody()’:
 .../fmt/test/format-test.cc:1486:56: error: no matching function for call to ‘ptr(void (&)(int, double, std::__cxx11::string))’
              format("{}", fmt::ptr(function_pointer_test)));

with GCC and Clang. Let's add an overload to support that usage.

Unfortunately, MSVC would
consider the overload to be ambiguous for unknown reasons:

 D:\a\fmt\fmt\test\format-test.cc(1485,1): error C2668: 'fmt::v7::ptr': ambiguous call to overloaded function [D:\a\fmt\build\test\format-test.vcxproj]
 D:\a\fmt\fmt\include\fmt/format.h(3742,60): message : could be 'const void *fmt::v7::ptr<void,int,double,std::string>(T (__cdecl *)(int,double,std::string))' [D:\a\fmt\build\test\format-test.vcxproj]
           with
           [
               T=void
           ]
 D:\a\fmt\fmt\include\fmt/format.h(3735,42): message : or       'const void *fmt::v7::ptr<void(int,double,std::string)>(T (__cdecl *))' [D:\a\fmt\build\test\format-test.vcxproj]
           with
           [
               T=void (int,double,std::string)
           ]
 D:\a\fmt\fmt\test\format-test.cc(1486,1): message : while trying to match the argument list '(overloaded-function)' [D:\a\fmt\build\test\format-test.vcxproj]

but luckily this means that the overload is unnecessary in that case
anyway, so we can just make it conditional.
2021-02-09 07:35:16 -08:00
..
args.h Move one more headers to args.h 2020-11-09 20:35:03 -08:00
chrono.h fix #2118: FMT_COMPILE did not work with tm formatter (#2119) 2021-01-30 08:44:49 -08:00
color.h Remove fallback to inline specifier from FMT_CONSTEXPR(20) macro (#2075) 2020-12-30 06:23:20 -08:00
compile.h fix #2116 (FMT_COMPILE requires exceptions enabled) (#2117) 2021-01-28 06:58:49 -08:00
core.h Remove fallback to inline specifier from FMT_CONSTEXPR(20) macro (#2075) 2020-12-30 06:23:20 -08:00
format-inl.h Fix writing to stdout when redirected to NUL on Windows (#2080) 2020-12-30 13:23:37 -08:00
format.h fmt::ptr: Support function pointers (#2131) 2021-02-09 07:35:16 -08:00
locale.h Workaround bugs in gcc 8 2020-11-01 06:08:28 -08:00
os.h Document output_file 2021-01-09 07:18:56 -08:00
ostream.h Suppress gcc warning on privates-only class (#2053) 2020-12-09 06:55:17 -08:00
posix.h Consistently namespace qualify size_t 2020-05-07 15:59:46 -07:00
printf.h Printf get container (#1982) 2020-11-12 08:37:04 -08:00
ranges.h Make ranges-test available with C++11 (#2114) 2021-01-30 07:42:58 -08:00