[OT] fortran lib which provide python like data type

Marko Rauhamaa marko at pacujo.net
Mon Feb 2 02:39:10 EST 2015


Michael Torrie <torriem at gmail.com>:

> http://en.cppreference.com/w/cpp/utility/functional/function
>
> Thus if we were to shoehorn your example into C++, the result would be
> idiomatically very similar to what you have in your Python code.

I can understand why you wouldn't write out my example in C++:

   using std::placeholders::_1;

   std::function<void(int)> f_add_display2 =
        std::bind( &Foo::print_add, foo, _1 );

vs

   f_add_display2 = foo.print_add

The cherry on top: "_1"! The C++ compiler figures out template types
heroically but can't wrap its head around the arity of the method.


Marko



More information about the Python-list mailing list