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: Thu, 14 Jun 2018 15:47:31 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:AzI7WR+3GSRmE/9uRHKM819IXTAuvvDOBiVQ1KB42uwcTK2v8tzYMVDF4r011RmVBdids6oMotGVmpioYXYH75eFvSJKW713fDhBt/8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1Ifn+FpLPg8it2O2+553ebx9UiDahfLh/MAi4oQLNu8cMnIBsMLwxyhzHontJf+RZ22ZlLk+Nkhj/+8m94odt/zxftPw9+cFAV776f7kjQrxDEDsmKWE169b1uhTFUACC+2ETUmQSkhpPHgjF8BT3VYr/vyfmquZw3jSRMMvrRr42RDui9b9mRgL2hicJNzA382/ZhcJ/g61ZvB2svAZwz5LObYyPKPZzcKHQcNUHTmRBRMZRUClBD5u7YYQVEeUBOftToo74p1QUsxS+AROgBPnoyj9ViX75w6k63/4lEQ7cxwMvBMwBvW/brNrrM6cSVP66zLXSzTTDYfNZwyvy6JTPchA7ofCAR65/cc3UyUQ2EQ7Ok1aeqZT9Mj+I1OkAsHKX4uRuWO61lmIrtwV8riKsy8swkoXEgp4ZxkrH+Ch42oo4JsG0RFRmbdOkDJddsTyROZFsTcM4WW5ovT43yr0Ytp6/eygH0IorywTaa/yAboSF4BDuWPyUIThihXJlfKuzhxGv8Ui80OH8Ude00FZQoipDjNbMqmgB1x3V6seZVvtw5lqt1DSM2gzJ5OxJL1o4mbfHJ5Ml2LI9lYYfvVzGHiDsmUX2iKGWdl8j+uit8+nnZ6/pqYGYN4NukAH+Nbkum8OhDuQ8KAQOW3KU9v+n27L95kD5T6tFjvozkqbHrJDaP8QapqCjDABJzoYj7Ay/Dje83NsEmnkHKUpJeAibgIjxJ1HOPPf4AO+jjFSjijhrw+nKMaDgApXWMnfDjazhfa1m5k5HyAszyMhf6IhOBrEAJvLzQE7xu8bCAh83KQzni9rgXd5y34dbVWOUCbKCK4vTt0WJ76QhObqifogQ7RP0Jvxts/vngHt/g1gAbaStm58eYnq1NvtrJECUfWD9jN4KDWAQr0w1S+m82w7KaiJae3vnB/F03To8Eo/zVd6SFLDou6SI2WKAJrMTY2lHDl6WFnKyLteLVvAJZT6IM8FomSADT6nnQIgkh0n36F3KjoF/J++RwRU28Ir53YIsteLekhQ/6SZlAc2Wz2aXXid/mWZaH2ZrjpA6mlR0zxK46YY9g/FcEoYNtakPVwBjasGayuV7D5X1Rx6HecmJDlCrXof+DA==

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