erikerlandson / st_tree

A fast and flexible c++ template class for tree data structures
https://github.com/erikerlandson/st_tree/wiki
Apache License 2.0
95 stars 20 forks source link

C++11 compatibility #16

Closed cafhach closed 8 years ago

cafhach commented 8 years ago

Hi there, I would like to use this very cool tree implementation, but if I add -std=c++11 to gcc 4.8.4 I cannot - for instance - compile the x03_keyed_children.cpp example anymore because I get prompted some weird conversion problem for a call deep within the st_tree code... something like "no known conversion from [...] const iterator [...] to [...] const_iterator".

/usr/include/c++/4.8/bits/stl_map.h:746:7: note: std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::erase(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator) [with _Key = const std::basicstring; _Tp = st_tree::detail::node_keyed<st_tree::tree<int, st_tree::keyed<std::basic_string > >, int, std::basic_string, std::lessstd::basicstring >; _Compare = st_tree::detail::ptr_lessstd::less<std::basic_string >; _Alloc = std::allocator; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const std::basic_string* const, st_tree::detail::node_keyed<st_tree::tree<int, st_tree::keyed<std::basic_string > >, int, std::basic_string, std::lessstd::basicstring >> >; std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<const std::basicstring const, st_tree::detail::node_keyed<st_tree::tree<int, st_tree::keyed<std::basic_string > >, int, std::basic_string, std::lessstd::basicstring >> >] erase(const_iterator __first, const_iterator __last) ^ /usr/include/c++/4.8/bits/stl_map.h:746:7: note: no known conversion for argument 1 from ‘const iterator {aka const st_tree::detail::valmap_iterator_adaptor_forward<std::_Rb_tree_iterator<std::pair<const std::basicstring const, st_tree::detail::node_keyed<st_tree::tree<int, st_tree::keyed<std::basic_string > >, int, std::basic_string, std::lessstd::basicstring >> >, st_tree::detail::dref_second_vmap<std::pair<const std::basicstring const, st_tree::detail::node_keyed<st_tree::tree<int, st_tree::keyed<std::basic_string > >, int, std::basic_string, std::lessstd::basicstring >> > >}’ to ‘std::map<const std::basicstring, st_tree::detail::node_keyed<st_tree::tree<int, st_tree::keyed<std::basic_string > >, int, std::basic_string, std::lessstd::basicstring >, st_tree::detail::ptr_lessstd::less<std::basic_string >, std::allocator >::const_iterator {aka std::_Rb_tree_const_iterator<std::pair<const std::basicstring const, st_tree::detail::node_keyed<st_tree::tree<int, st_tree::keyed<std::basic_string > >, int, std::basic_string, std::lessstd::basic_string >*> >}’

erikerlandson commented 8 years ago

@cafhach thanks for letting me know, I'll try to figure this out soon

erikerlandson commented 8 years ago

@cafhach The fix on PR #17 is working for me, if it works for you too I'll merge it