c++ - CPP reference to pointer in std::list -


this question has answer here:

this following code doesn't want compile:

#include <list>  int main() {   std::list<int *&> l;    return 0; } 

it's *& , not *. why ? ho hell why doesn't work ? tried answer on internet no way relevant. please ?

have day !

it not allowed use references container type. can use std::reference_wrapper instead.

std::list<std::reference_wrapper<int>> l; 

or can use pointer pointer

 std::list<int**> l; 

Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -