Consider the following code:
#include <string>
#include <list>
using namespace std;
int main(int argc, const char * argv[])
{
list<int> l{1,2,3,4};
list<list<int>> ll;
ll.push_back(l);
return 0;
}
After the push_back
, the ll
list is containing one empty element.
I am wondering why it is not filled with the content of list l
.
Note: I am on Mac OS 10.9 using Xcode 5.0.1.
Edit 1:
Here is the lldb output:
(lldb) p l
(std::__1::list<int, std::__1::allocator<int> >) $0 = size=4 {
[0] = 1
[1] = 2
[2] = 3
[3] = 4
}
(lldb) p ll
(std::__1::list<std::__1::list<int, std::__1::allocator<int> >, std::__1::allocator<std::__1::list<int, std::__1::allocator<int> > > >) $1 = size=1 {
[0] = size=0 {}
}
(lldb)
Edit 2
As @molbdnilo said, it looks like a debugger issue because when a new list initialized with the first item of ll
I get the same content than in l
.