Below is excerpted from cppref:
template<class...>
class move_only_function; // not defined
template<class R, class... Args>
class move_only_function<R(Args...) const>;
I also tried the following code:
// ok
std::function<int(int)> fn;
// error: implicit instantiation of undefined template
// 'std::function<void () const>'
std::function<int(int) const> fn;
Is int(int) const a valid function type in C++23?
Yes,
int(int) consthas always been(even before c++23) a function type. Evenauto(int)const->intis a function type.This can be seen from dcl.fct:
(emphasis mine)
This means that both are
auto(int)const->intas well asint(int)constare function type.