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

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

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