Subject: CGAL users discussion list
List archive
- From: Panagiotis Zestanakis <>
- To:
- Subject: Re: [cgal-discuss] using lambdas with function interpolation
- Date: Fri, 15 Jun 2018 12:45:15 +0300
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:0zTYjRQAL81IUeJJVXa4RjLsUtpsv+yvbD5Q0YIujvd0So/mwa69ZRyN2/xhgRfzUJnB7Loc0qyK6/2mATRIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfbN/IA+qoQnNq8IbnZZsJqEtxxXTv3BGYf5WxWRmJVKSmxbz+MK994N9/ipTpvws6ddOXb31cKokQ7NYCi8mM30u683wqRbDVwqP6WACXWgQjxFFHhLK7BD+Xpf2ryv6qu9w0zSUMMHqUbw5Xymp4qF2QxHqlSgHLSY0/27ZisNyjKxVrhGvqQFhzYHIe4yaLuZyc7nHcN8GWWZMXMBcXDFBDIOmaIsPCvIMM/xCoIn7vVQOohq+BQ6wBOPu0T9Dm3z50rMh0+Q9Cw7G2hYvH9EPsHTPsd74M78SXvqzzKnP1jXCbuhb2Tj46IfScxAhpeuAUq53ccrU0EQiER7OgFaIqYH9IT+ZyuAAv3KY4udgT+6jlXMrpgBrrjSyx8ohjo/EjZ8PxF/e7yV22oM1KMW4SEFlZd6kF4NdtySAOIt3RsMuWnhouDomxrEft563YSkHxZA9yx7QbPyHdIeI4hb9W+qLPTh4g3dldKq+hxa070eg1vXxWteo3FtOtCZIkdnBumoT2xDO68WLUOZx80al1DqX0gDc8OBEIUQ6larBLJ4hx6Y9loIJvkTFGS/2g0T3gbSZdkUh4Oeo6uDnbq/6qZ+bMo94khv+Pbg2msyjHeQ4NRADUHSU+eum0L3v5FD2QLRRjvIqj6nZq4vaKN8Apq+5Bg9Vypws5wy+DzegytQYnGMIIEhLeBKd3MDVPATFL/n8SPu+mF+xiyxDxvbcP7SnDI+eAGLEleLZdLB05E9b1AsoheJS/I5dDLgCIem7Dlf4stvDHDc2NgW1x6DsD9ArhdBWYn6GHqLMaPCailSP/O96e7DdNr9Qgy70Lr0e39CriHY4nVEHeqzwhMkYbXm5GrJtJEDLOCOw0OdEKn8Du08FdMKvkEeLCGcBaHO7XqZ67TY+Wtr/UNXzA7u1ibnE5x+VW51bYmccVAKJGHbsMpyYA7ICMXzDZMBmlTMAWP6qTIpzjRw=
Thank you, Mael!
Hello,
The simplest to keep your lambda is probably to modify the CGAL function: replacing the instances of ::result_type in linear_interpolation() by
typename boost::result_of<ValueFunctor(typename std::iterator_traits<ForwardIterator>::value_type::first_type)>::type::first_type
will make it work with lambdas as well as more traditional inputs.
I'll make a patch for CGAL to use result_of in the Interpolation package.
Best,
Mael
On 06/14/2018 12:54 PM, Panagiotis Zestanakis wrote:
Dear All,
Does anyone know any way to directly pass a lambda as a functor to an interpolation function?For example, the signature of the linear interpolation function:template < class ForwardIterator, class Functor> typename Functor::result_type::first_type linear_interpolation(ForwardIterator first, ForwardIterator beyond, const typename std::iterator_traits<ForwardIterator>::value_type:: second_type& norm, Functor function_value)requires Functor to provide a type Functor::result_type. This makes it impossible to pass a raw lambda.Of course one could wrap the lambda with e.g. std::function, but in many cases this is not optimal performance-wise nor style-wise.
Is there any other way to pass a raw lambda that I am not aware of?If not, are there any plans to support lambdas in future releases?
Best,Panos
- [cgal-discuss] using lambdas with function interpolation, Panagiotis Zestanakis, 06/14/2018
- Re: [cgal-discuss] using lambdas with function interpolation, Mael, 06/14/2018
- Re: [cgal-discuss] using lambdas with function interpolation, Panagiotis Zestanakis, 06/15/2018
- Re: [cgal-discuss] using lambdas with function interpolation, Mael, 06/15/2018
- Re: [cgal-discuss] using lambdas with function interpolation, Panagiotis Zestanakis, 06/15/2018
- Re: [cgal-discuss] using lambdas with function interpolation, Mael, 06/14/2018
Archive powered by MHonArc 2.6.18.