but it gives me 0, which is not good
, GDB, GDB, git . :
(gdb) start
Temporary breakpoint 1 at 0x400865: file foo.cc, line 27.
Starting program: /tmp/a.out
Temporary breakpoint 1, main () at foo.cc:27
27 auto& db = test::DB<int, int>::instance();
(gdb) n
28 return 0;
(gdb) p 'test::DB<int, int, std::map<int, int, std::less<int>, std::allocator<std::pair<int const, int> > > >::instance()::_instance'
$1 = 0
. , _instance:
(gdb) info var _instance
All variables matching regular expression "_instance":
Non-debugging symbols:
0x0000000000602088 guard variable for test::DB<int, int, std::map<int, int, std::less<int>, std::allocator<std::pair<int const, int> > > >::instance()::_instance
0x00000000006020a0 test::DB<int, int, std::map<int, int, std::less<int>, std::allocator<std::pair<int const, int> > > >::instance()::_instance
... 0x00000000006020a0 :
(gdb) p ('test::DB<int, int, std::map<int, int, std::less<int>, std::allocator<std::pair<int const, int> > > >' *)0x00000000006020a0
$2 = (test::DB<int, int, std::map<int, int, std::less<int>, std::allocator<std::pair<int const, int> > > > *) 0x6020a0 <test::DB<int, int, std::map<int, int, std::less<int>, std::allocator<std::pair<int const, int> > > >::instance()::_instance>
, :
(gdb) p *$
$3 = {_db_internal = {_M_t = {_M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<int const, int> > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<int const, int> > >> = {<No data fields>}, <No data fields>},
_M_key_compare = {<std::binary_function<int, int, bool>> = {<No data fields>}, <No data fields>}, _M_header = {_M_color = std::_S_red, _M_parent = 0x0,
_M_left = 0x6020a8 <test::DB<int, int, std::map<int, int, std::less<int>, std::allocator<std::pair<int const, int> > > >::instance()::_instance+8>,
_M_right = 0x6020a8 <test::DB<int, int, std::map<int, int, std::less<int>, std::allocator<std::pair<int const, int> > > >::instance()::_instance+8>}, _M_node_count = 0}}}}
P.S. <int,int> , , . ( , ).