Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] using lambdas with function interpolation

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] using lambdas with function interpolation


Chronological Thread 
  • From: Mael <>
  • To:
  • Subject: Re: [cgal-discuss] using lambdas with function interpolation
  • Date: Fri, 15 Jun 2018 13:06:24 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:9Nr8RBGmeer+WziHtm2SzZ1GYnF86YWxBRYc798ds5kLTJ7zpMywAkXT6L1XgUPTWs2DsrQY07eQ6/iocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmDqwbaluIBmqsA7cqtQYjYx+J6gr1xDHuGFIe+NYxWNpIVKcgRPx7dqu8ZBg7ipdpesv+9ZPXqvmcas4S6dYDCk9PGAu+MLrrxjDQhCR6XYaT24bjwBHAwnB7BH9Q5fxri73vfdz1SWGIcH7S60/VDK/5KlpVRDokj8KOSMn/mHZisJ+j6xVrxyuqBN934HZe5uaOOZkc67HYd8XS2hMU8BMXCJBGIO8aI4PAvIGM+lCsYb9o0YFoBy7BQa2GuzvziVEhmXx3a0n3OUuDwXG0BYkH90Uq3vbt8v6ObwdUe+ry6nIyCvMb+9M2Tb95ojHaAwuoe2LXbJqccvd01UgFwTAjliJr4HuIj2b1uMIs2eB7upgU/qii2EmqwFtojiv29wjhpPViYISz1DJ8zhyzoUtJdCgR0N2YMSoHIZMuyyaLYd7TMcvT3tptSon0rELvYK3cDIJxZkm3RLSaOCLf5KV7h/jSOqcJypzimh/d7KlnRmy9FCtyu3iWcmw11ZHtjRJnsPJtnAKyhDe6MuKRuF4/ki72DaP0xnf6uZZIUAoj6bbLIAhwr4qmpoVr0vDAjf6mETwjKCIakUp4uel5uX9brn7upORN5V4hw/6P6g0m8GzHPw0Mg0UUGia/eS82qfj/Ur8QLhSi/05iLfWsJTAKcQBoa65HgBU3Zgn6xqlCzepys8XkmIZI19edxKIkY/pO1TQL/DkF/e+g1qsny13yPDaOb3hGJXMImLfn7fmeLZx81RcxxYrzdBD+5JUDakML+78WkDrsNzUFwI2Mw2vw+n7FdV9zZgeVHmUAq6ZNaPSqUWH6vguI+mKfo8VuSzyJ+Ir5/703jcFngoWcqCtmJcWc3ulBe9OIkODYHOqjM1SP30Nu18bReHuwAmHWDNXIWy1QrIx4nc/AYisAK/MS4eojaCbzSmyFYFRfHEAAVeJRyS7P76YUusBPXrBavRqlSYJAOD4Gt0RkCq2vQq/8IJJa+/d+ykWr5XmjoEn6ODUkBwu7y16Bs+B1HucCWpzmzFQHmNk7OVEuUV4j2y7/+1gmfUCTI5c6vRMXxsgJJDVxPB9EcG0UQXELI/QFQSWB+6+CDR0deofht8DZ0EnRYf4yBXEhnX6RboclrjOA4EotKXC3z73Ktovk3s=

Please see this pull request for the patch on the whole Interpolation package.

Best,
Mael

On 06/15/2018 11:45 AM, Panagiotis Zestanakis wrote:
Thank you, Mael!

On Thu, Jun 14, 2018 at 4:48 PM Mael <> wrote:

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





Archive powered by MHonArc 2.6.18.

Top of Page