'Can't "format_to" pointers

I'm trying to format (Pass) pointers to a string.

std::string buf;

std::format_to(std::back_inserter(buf), "Press {:s} {:s} [{:d}m] {:p} {:p}", string, string, int, pointer, pointer);

When trying to compile the code I get an "std::_Format_arg_traits" Compiler Error, It's probably because I formated it wrong (it's not {:p} ).

I took a look at the Format Syntax and everything looks ok. Sprintf works perfectly:

char buf[0x128];
sprintf(buf, " %s %s [%d] (%p) (%p)", string, string, int, pointer, pointer);

The compiler breaks when I include the {:p} What am I doing wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source