1

According to cppref:

The std::placeholders namespace contains the placeholder objects [_1, . . ., _N] where N is an implementation defined maximum number.

I checked libstdc++'s header file functional and found the N is 29.

Is there a standard way to check that? Say, a feature test macro?

xmllmx
  • 39,765
  • 26
  • 162
  • 323
  • 2
    Why do you even need this? trying to use one above the limit would anyway not build. Also, this is kind of deprecated with lambdas. – Adrian Maire May 22 '21 at 12:30
  • 2
    Interestingly experimenting with Wandbox and Godbolt it seems there can be quite a difference: I get 29 for GCC on Wandbox and Godbolt, 10 for Clang on Wandbox and 29 for Clang on Godbolt and 20 for MSVC in Godbolt. – 2b-t May 22 '21 at 12:43
  • 2
    Also, you can [define](https://en.cppreference.com/w/cpp/utility/functional/is_placeholder#Example) your own placeholders and used them if you really need a lot and don't want to be restricted by the standard library implementation – dewaffled May 22 '21 at 15:17

0 Answers0