I know the question is rather theoretical but I think if placeholders would be defined as the template like e.g.:
namespace std {
namespace placeholders {
template <size_t> struct placeholder { constexpr placeholder() {}; };
template <size_t N> constexpr placeholder<N> _{};
}
}
with usage:
std::bind(foo, std::placeholders::_<1>, std::placeholders::_<2>);
Or for c++11:
namespace std {
namespace placeholders {
template <size_t> struct _ { };
}
}
with usage:
std::bind(foo, std::placeholders::_<1>{}, std::placeholders::_<2>{});
the code wouldn't loose anything of its clearness and we would be able to do some fancy metaprogramming using it. So... why aren't placeholders for std::bind
implemented using non-type template parameters?