Boost logo

Boost :

Subject: Re: [boost] [ boost ] [ Trie ]
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2015-02-24 02:42:36


2015-02-23 23:04 GMT+04:00 Cosmin Boaca <boost.cosmin.boaca_at_[hidden]>:

> Hello,
>
> I really don't know what do to. I'm getting some compile errors that make
> no sense for me. For instance :
> trie_map<int, int> tm;
> trie<int, int> t;
> trie_map<int, int>::const_iterator it(tm.cend()); // raises compile error
> trie<int, int>::const_iterator(t.cend()); // works fine
>
> I have no idea why the compile error is raised there. Should I push the
> changes so you may take a look ?
>

First error is in trie_set at line 50. There trie_type t is used which is
trie<key_type, value_type>. trie_set::iterator is a const iterator, while
trie<key_type, value_type> can also return nonconst iterators.Take a look
at line 50 in trie_set.hpp:

iterator begin()
{
    return t.begin();
}

Here `iterator` is a `const_iterator`, while `t.begin();` returns nonconst
iterator. Solution would be a call to `t.cbegin()` method. In that case
const_iterator will be returned.

Investigate the problem further, same errors are with non const qualified
end(), rend(), rbegin()

A few more notes:

* line 238 at trie.hpp requires C++11 because of std::ref. This can be
relaxed, if you'll rewrite the body:
return std::pair<std::vector<key_type>, Value&>(get_key(), vnode->value);

* Boost folders structures changed since 2013. Rearrange folders like it is
described here:
http://rrsd.com/blincubator.com/requirements_directory_structure/ . Also
you may take a look into the https://github.com/apolukhin/Boost.DLL to see
how the folders must look like. There in Installation section of Readme
you'll find a simple way to install new library/trie into the existing
boost installation.

* When it's done, try to setup autotesting, using this manual:
https://svn.boost.org/trac/boost/wiki/TravisCoverals . This will give you a
simple way to auto test code on Linux platform.

In case of any errors or problems do not hesitate to contact me and ask
questions.

-- 
Best regards,
Antony Polukhin

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