c++ - How to use const qualifier with decltype? -


how use const qualifier decltype template-ed function ?

current gcc rejects following :

template <typename it> bool process(it first , last ) {    return  std::all_of( first, last,                         [](  const decltype(*first)& )                        //   ^^^^^ without const works fine                        {                              return % 2 == 0;                         }                       ) ; } 

is legal/possible use i const reference inside lambda ?

const decltype(*first)& doesn't work because decltype(*first) int&, expect int. can use std::remove_reference work around (although doesn't make code clearer): const std::remove_reference<decltype(*first)>::type&


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -