c++ - CPP reference to pointer in std::list -
this question has answer here:
- stl containers reference objects 4 answers
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
Post a Comment