fork(1) download
  1. #include <algorithm>
  2. #include <functional>
  3. #include <vector>
  4.  
  5. struct Something
  6. {
  7. };
  8.  
  9. template<class T>
  10. T Function(const T& x, int s)
  11. {
  12. // blah blah
  13. return x;
  14. }
  15.  
  16. int main()
  17. {
  18. std::vector<Something> data(20);
  19. std::transform(data.begin(), data.end(), data.begin(), std::bind2nd(std::ptr_fun(Function<Something>), 8));
  20. }
  21.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
In file included from /usr/include/c++/4.8/bits/stl_function.h:731:0,
                 from /usr/include/c++/4.8/functional:49,
                 from prog.cpp:2:
/usr/include/c++/4.8/backward/binders.h: In instantiation of ‘class std::binder2nd<std::pointer_to_binary_function<const Something&, int, Something> >’:
prog.cpp:19:106:   required from here
/usr/include/c++/4.8/backward/binders.h:159:7: error: ‘typename _Operation::result_type std::binder2nd<_Operation>::operator()(typename _Operation::first_argument_type&) const [with _Operation = std::pointer_to_binary_function<const Something&, int, Something>; typename _Operation::result_type = Something; typename _Operation::first_argument_type = const Something&]’ cannot be overloaded
       operator()(typename _Operation::first_argument_type& __x) const
       ^
/usr/include/c++/4.8/backward/binders.h:153:7: error: with ‘typename _Operation::result_type std::binder2nd<_Operation>::operator()(const typename _Operation::first_argument_type&) const [with _Operation = std::pointer_to_binary_function<const Something&, int, Something>; typename _Operation::result_type = Something; typename _Operation::first_argument_type = const Something&]’
       operator()(const typename _Operation::first_argument_type& __x) const
       ^
stdout
Standard output is empty