Boost logo

Boost :

Subject: Re: [boost] [ boost ] [ Trie ]
From: Cosmin Boaca (boost.cosmin.boaca_at_[hidden])
Date: 2015-02-23 08:55:17


Hello,

I have encountered some problems when I have tried to remove the 2 template
parameters. I have tried to do it this way :

in trie_iterator class i have modified the following typedefs

 typedef trie_iterator<Key, Value> iterator
 typedef trie_iterator<Key, Value> iter_type;
 tpyedef trie_iterator<Key, const Value> const_iterator;
 typedef std::pair<std::vector<key_type>, Value&> reference;
 typedef std::pair<std::vector<key_type>, Value&>* pointer;

And in trie class
typedef detail::trie_iterator<Key, Value> iterator

I thought this was the only thing I need to modify in order to solve the
task but it doesn't work. Actually, the following code doesn't work and I
can't figure out why :

boost::tries::trie<char, int> t;
boost::tries::trie<char, int>::const_iterator ci = t.end();

It raises compile time error that says it cannot convert from iterator to
const_iterator. Basically it seems that it's called the end method that
returns iterator instead of the const one and I can't figure out why. If i
change from end to cend then it works.

Thank you,
Cosmin


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk