I recently spent quite some time understanding the error message when calling func()
in this piece of code:
int main()
{
vector< vector&l
This behavior is well-defined (every correct C++ compiler will fail to compile your code).
From the standard (N3376) section D.9.3
on class template binder2nd
, these two defintions of operator()
exist:
typename Fn::result_type
operator()(const typename Fn::first_argument_type& x) const;
typename Fn::result_type
operator()(typename Fn::first_argument_type& x) const;
If first_argument_type
is already a const T&
, then they will be conflicting.