Please explain how someone should reason to deduce
the type specifications of the _Func parameter of std::for_each?
Motivation behind the questions is to understand the type requirements from method signature.
template<class _InIt, class _Fn1> inline
_Fn1 for_each(_InIt _First, _InIt _Last, _Fn1 _Func) {
_DEBUG_RANGE(_First, _Last);
_DEBUG_POINTER(_Func);
_For_each(_Unchecked(_First), _Unchecked(_Last), _Func);
return (_STD move(_Func));
}
This particular signature doesn’t say anything about types at all. It’s a template which will accept 3 arguments, 2of them being of the same type.
To see what restrictions are imposed on the types of input arguments you should read the implementation of
_For_each, which I bet in turn will have two dozens of specialisations and delegations.Reading STL source code is a sheer nightmare.
So, as suggsted in comments, give it up and go read the documentation.